Lines 165-173
Link Here
|
165 |
|
165 |
|
166 |
} |
166 |
} |
167 |
private void writeJDKHome(){ |
167 |
private void writeJDKHome(){ |
|
|
168 |
PrintWriter ps = null; |
169 |
FileReader fr = null; |
168 |
try { |
170 |
try { |
169 |
String file = productInstallLocation + File.separator + "bin" + File.separator + "ide.cfg"; //NOI18N |
171 |
String file = productInstallLocation + File.separator + "bin" + File.separator + "ide.cfg"; //NOI18N |
170 |
PrintWriter ps = new PrintWriter(new BufferedWriter(new FileWriter(file,true))); |
|
|
171 |
int jreIndex = javaHome.indexOf("jre"); //NOI18N |
172 |
int jreIndex = javaHome.indexOf("jre"); //NOI18N |
172 |
if(jreIndex != -1){ |
173 |
if(jreIndex != -1){ |
173 |
jdkHome = javaHome.substring(0,javaHome.length()-4); |
174 |
jdkHome = javaHome.substring(0,javaHome.length()-4); |
Lines 175-191
Link Here
|
175 |
//check if it is really jdk - not only jre |
176 |
//check if it is really jdk - not only jre |
176 |
File compiler = new File(jdkHome + separator+"bin"+separator+"javac"); //NOI18N |
177 |
File compiler = new File(jdkHome + separator+"bin"+separator+"javac"); //NOI18N |
177 |
if(compiler.exists()){ |
178 |
if(compiler.exists()){ |
178 |
FileReader fr = new FileReader(file); |
179 |
fr = new FileReader(file); |
179 |
String[] line = fileService.readAsciiFile(file); |
180 |
String[] line = fileService.readAsciiFile(file); |
180 |
for(int i=0; i < line.length; i++){ |
181 |
for(int i=0; i < line.length; i++){ |
181 |
if(line[i].indexOf("-jdkhome") != -1) //NOI18N |
182 |
if(line[i].indexOf("-jdkhome") != -1) //NOI18N |
182 |
return; |
183 |
return; |
183 |
} |
184 |
} |
|
|
185 |
fr.close(); |
186 |
ps = new PrintWriter(new BufferedWriter(new FileWriter(file,true))); |
184 |
ps.println("-jdkhome " + jdkHome ); //NOI18N |
187 |
ps.println("-jdkhome " + jdkHome ); //NOI18N |
185 |
ps.close(); |
188 |
ps.close(); |
186 |
} |
189 |
} |
187 |
} catch (Exception e) { |
190 |
} catch (Exception e) { |
188 |
logEvent(this, Log.ERROR, e); |
191 |
logEvent(this, Log.ERROR, e); |
|
|
192 |
}finally{ |
193 |
if(ps != null) |
194 |
ps.close(); |
195 |
if(fr != null) |
196 |
try{ |
197 |
fr.close(); |
198 |
}catch(Exception exp){ |
199 |
logEvent(this, Log.ERROR, exp); |
200 |
} |
189 |
} |
201 |
} |
190 |
} |
202 |
} |
191 |
|
203 |
|