1212import net .sf .j2s .ui .classpath .CompositeResources ;
1313import net .sf .j2s .ui .classpath .IRuntimeClasspathEntry ;
1414import net .sf .j2s .ui .classpath .Resource ;
15+ import net .sf .j2s .ui .property .FileUtil ;
16+ import net .sf .j2s .ui .resources .ExternalResources ;
1517
1618import org .eclipse .core .resources .IContainer ;
1719import org .eclipse .core .resources .IProject ;
@@ -206,14 +208,26 @@ private static String generateHTML(ILaunchConfiguration configuration,
206208buf .append (configuration .getAttribute (
207209IJ2SLauchingConfiguration .HEAD_HEADER_HTML ,"" ));
208210
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 " );
210224
211225buf .append (configuration .getAttribute (
212226IJ2SLauchingConfiguration .TAIL_HEADER_HTML ,"" ));
213227buf .append ("</head>\r \n " );
214228buf .append ("<body>\r \n " );
215229if (useInnerConsole ) {
216- buf .append ("<div id=\" _console_\" class=\" consolewindow\" ></div>\r \n " );
230+ // buf.append("<div id=\"_console_\" class=\"consolewindow\"></div>\r\n");
217231}
218232buf .append (configuration .getAttribute (
219233IJ2SLauchingConfiguration .HEAD_BODY_HTML ,"" ));
@@ -229,17 +243,27 @@ private static String generateHTML(ILaunchConfiguration configuration,
229243}
230244String path =javaProject .getOutputLocation ().toString ();
231245int idx =path .indexOf ('/' ,2 );
232- String relativePath =null ;
246+ String relativePath ="" ;
233247if (idx != -1 ) {
234248relativePath =path .substring (idx +1 );
235249}
236250/*
237251 * MainType Class may already included in the header section
238252 */
239253//buf.append(wrapTypeJS(mainType, relativePath));
254+
240255buf .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+
241263String args =configuration .getAttribute (IJavaLaunchConfigurationConstants .ATTR_PROGRAM_ARGUMENTS , (String )null );
264+ buf .append ("ClazzLoader.loadClass (\" " +mainType +"\" , function () {\r \n " );
242265buf .append ("" +mainType +".main(" +ArgsUtil .wrapAsArgumentArray (args ) +");\r \n " );
266+ buf .append ("});\r \n " );
243267buf .append ("</script>\r \n " );
244268
245269buf .append (configuration .getAttribute (