12
12
import net .sf .j2s .ui .classpath .CompositeResources ;
13
13
import net .sf .j2s .ui .classpath .IRuntimeClasspathEntry ;
14
14
import net .sf .j2s .ui .classpath .Resource ;
15
+ import net .sf .j2s .ui .property .FileUtil ;
16
+ import net .sf .j2s .ui .resources .ExternalResources ;
15
17
16
18
import org .eclipse .core .resources .IContainer ;
17
19
import org .eclipse .core .resources .IProject ;
@@ -206,14 +208,26 @@ private static String generateHTML(ILaunchConfiguration configuration,
206
208
buf .append (configuration .getAttribute (
207
209
IJ2SLauchingConfiguration .HEAD_HEADER_HTML , "" ));
208
210
209
- buf .append (generateClasspathHTML (configuration , mainType , workingDir ));
211
+ // buf.append(generateClasspathHTML(configuration, mainType, workingDir));
212
+ String [][] allResources = ExternalResources .getAllResources ();
213
+ String j2sLibPath = null ;
214
+ if (allResources != null && allResources .length != 0 && allResources [0 ].length != 0 ) {
215
+ if ((allResources [0 ][0 ]).startsWith ("|" )) {
216
+ allResources [0 ][0 ] = FileUtil .toRelativePath (allResources [0 ][0 ].substring (1 ),
217
+ workingDir .getAbsolutePath ());;
218
+ }
219
+ j2sLibPath = allResources [0 ][0 ].substring (0 , allResources [0 ][0 ].lastIndexOf ("/" ) + 1 );
220
+ } else {
221
+ j2sLibPath = "../net.sf.j2s.lib/j2slib/" ;
222
+ }
223
+ buf .append ("<script type=\" text/javascript\" src=\" " + j2sLibPath + "j2slib.z.js\" ></script>\r \n " );
210
224
211
225
buf .append (configuration .getAttribute (
212
226
IJ2SLauchingConfiguration .TAIL_HEADER_HTML , "" ));
213
227
buf .append ("</head>\r \n " );
214
228
buf .append ("<body>\r \n " );
215
229
if (useInnerConsole ) {
216
- buf .append ("<div id=\" _console_\" class=\" consolewindow\" ></div>\r \n " );
230
+ // buf.append("<div id=\"_console_\" class=\"consolewindow\"></div>\r\n");
217
231
}
218
232
buf .append (configuration .getAttribute (
219
233
IJ2SLauchingConfiguration .HEAD_BODY_HTML , "" ));
@@ -229,17 +243,27 @@ private static String generateHTML(ILaunchConfiguration configuration,
229
243
}
230
244
String path = javaProject .getOutputLocation ().toString ();
231
245
int idx = path .indexOf ('/' , 2 );
232
- String relativePath = null ;
246
+ String relativePath = "" ;
233
247
if (idx != -1 ) {
234
248
relativePath = path .substring (idx + 1 );
235
249
}
236
250
/*
237
251
* MainType Class may already included in the header section
238
252
*/
239
253
//buf.append(wrapTypeJS(mainType, relativePath));
254
+
240
255
buf .append ("<script type=\" text/javascript\" >\r \n " );
256
+ buf .append ("ClazzLoader.j2slibClasspath (\" " );
257
+ buf .append (j2sLibPath );
258
+ buf .append ("\" );\r \n " );
259
+ buf .append ("ClazzLoader.setPrimaryFolder (\" " );
260
+ buf .append (relativePath );
261
+ buf .append ("\" );\r \n " );
262
+
241
263
String args = configuration .getAttribute (IJavaLaunchConfigurationConstants .ATTR_PROGRAM_ARGUMENTS , (String ) null );
264
+ buf .append ("ClazzLoader.loadClass (\" " + mainType + "\" , function () {\r \n " );
242
265
buf .append ("" + mainType + ".main(" + ArgsUtil .wrapAsArgumentArray (args ) + ");\r \n " );
266
+ buf .append ("});\r \n " );
243
267
buf .append ("</script>\r \n " );
244
268
245
269
buf .append (configuration .getAttribute (
0 commit comments