@@ -30,6 +30,7 @@ the Java Virtual Machine in JavaScript. Its two main JavaScript objects are
3030 Clazz (methods that emulate core java.lang methods) and
3131 J2S (methods that provide an interface to the HTML5 document model)
3232
33+ <<<<<<< HEAD
3334Raw JavaScript files are in site/swingjs/js, These files are concatenated into
3435site/swingjs/swingjs2.js, which your web page needs to call. For example:
3536
@@ -60,8 +61,160 @@ Eclipse Photon or higher is necessary.
6061
6162 net.sf.j2s.core_3.2.1.jar replaces net.sf.j2s.core_3.1.1.jar
6263
64+
6365 These versions differ only in their internal workings relative to Eclipse (and new bug fixes).
6466
67+ Most importantly, the requirement that the .project file be changed to
68+ indicate a customized Java builder is dropped in version 3.2.1, which just uses
69+ the standard Eclipse java builder, org.eclipse.jdt.core.javabuilder.
70+
71+ If you are updating to 3.2.x from 3.1.1, be sure to open your .project file and change the
72+ builder name from net.sf.j2s.core.java2scriptbuilder back to org.eclipse.jdt.core.javabuilder
73+ or your project will no longer compile.
74+
75+ ---------------------------------------------------------
76+ Installing the Java2Script compiler as an Eclipse plug-in
77+ ---------------------------------------------------------
78+
79+ The easiest thing to do is to copy the contents of the dist/ directory
80+
81+ https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist
82+
83+ into your project directory. It contains the following directories:
84+
85+ swingjs/
86+ -- contains the necessary Eclipse drop-in as well as the run-time
87+ -- ver/ subfolder holds older versions
88+ tools/
89+ -- contains ant-contrib.jar, used by build-site.xml
90+ libjs/
91+ -- empty; reserved for foo.zip equivalents of dependency foo.jar files
92+ -- these will be unzipped into site/ by build-site.xml
93+ resources/
94+ -- empty; reserved for non-java resources your program might need
95+ -- these will go into site/swingjs/j2s by build-site.xml
96+
97+ and files:
98+
99+ .j2s -- a starter j2s configuration file
100+ build-site.xml -- run this to build the site/ directory before or after you
101+ update your Java code.
102+
103+ The following instructions include instructions for doing some of this manually:
104+
105+ 1. Copy net.sf.j2s.core.jar from
106+
107+ https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist/swingjs
108+
109+ specifically:
110+
111+ https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist/swingjs/net.sf.j2s.core.jar?raw=true
112+
113+ into your eclipse/dropins directory.
114+
115+ Also provided in that directory is a ver/ directory with previous core files.
116+ These files have names that are purposely unversioned because some versions of Eclipse
117+ will have to be entirely reinstalled every time you change versions if the names are different
118+ from version to version. We do not know why this is necessary, but it appears to be.
119+ This is an Eclipse bug. So just always use dist/swingjs/net.sf.j2s.core.jar.
120+
121+ On Mac systems, the Eclipse directory is generally
122+
123+ /Applications/Eclipse.app/Contents/Eclipse/dropins
124+
125+ 2. Restart Eclipse and check for the presence of the plug-in at
126+ help...about Eclipse...installation details...Plug-ins...(wait several seconds for tabulation)
127+
128+ Search for "j2s" to find j2s.sourceforge.net Java2Script Core
129+
130+ If that is not there, you don't have net.sf.j2s.core.jar in the proper directory.
131+
132+ Note relating to updating to 3.2.x from 3.1.1 version of Java2Script:
133+
134+ If the version on this readout does not match the version that is
135+ reported at the end of each .js file created:
136+
137+ //Created 2018-07-15 04:35:10 net.sf.j2s.core.jar v. 3.2.1
138+
139+ then there is no real problem, but you can correct that by restarting
140+ Eclipse once with the -clean flag.
141+
142+ -------------------------------------------------------
143+ Updating the Java2Script compiler or SwingJS run-time
144+ -------------------------------------------------------
145+
146+ If the Java2Script compiler is updated on GitHub, just update the swingjs/ directory from
147+ GitHub, replace the eclipse/dropins/net.sf.j2s.core.jar file with the new one, and
148+ restart Eclipse.
149+
150+ If the SwingJS runtime is updated on GitHub, update the swingjs/ directory from GitHub
151+ and run build-site.xml.
152+
153+ ----------------------------------
154+ Creating a new J2S/SwingJS project
155+ ----------------------------------
156+
157+ Creating a new J2S/SwingJS project is very simple.
158+
159+ First create an Eclipse Java project for your work, if you have not done so already.
160+ If your source code is not all already in src/, navigate to the project...properties...
161+ Java Build Path...source and add all the source directories you need.
162+
163+ Note that your project must not include any Jar file-based dependencies.
164+ All source code must be available. (Source code from decompiling .class files will work,
165+ but it is not automatic, and we have not explored that option yet.)
166+
167+ ---------------------------------------------------------------------
168+ Installing the SwingJS JavaScript version of the Java Virtual Machine
169+ ---------------------------------------------------------------------
170+
171+ Chrome users should consider using WebServer for Chrome to serve local files.
172+
173+ https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en
174+
175+ It is very simple to set up.
176+
177+ Firefox users need only set the about:config flag:
178+
179+ security.fileuri.strict_origin_policy
180+
181+ to "false".
182+
183+ All of the JavaScript produced will be in the project site/ directory.
184+ You must prepopulate this site with all the JavaScript required by the
185+ SwingJS JavaScript version of the JVM. The most recent version of site/ is at
186+ =======
187+ Raw JavaScript files are in site/swingjs/js, These files are concatentated into
188+ site/swingjs/swingjs2.js, which your web page needs to call. For example:
189+
190+ <!DOCTYPE html>
191+ <html><title>...</title>
192+ <head><meta charset="utf-8" />
193+ <script src="swingjs/swingjs2.js"></script>
194+ ...
195+
196+ Besides that, all the java, javax, swingjs, and various other classes can be found
197+ in the site/swingjs/j2s directory.
198+
199+ jQuery is used extensively, and a slightly enhanced version of jQuery (see site/swingjs/js/j2sJQueryExt)
200+ adds synchronous binary file transfer as well as "jQuery outside events".
201+
202+ The SwingJS runtime is distributed as SwingJS-site.zip, which you can unzip yourself into
203+ your project site/ directory or let build-site.xml do that for you.
204+
205+ -------------------------
206+ INSTALLATION INSTRUCTIONS
207+ -------------------------
208+
209+ Eclipse Photon or higher is necessary.
210+
211+ ----------------------------------------------------------
212+ Important note to users using 3.1.1 and upgrading to 3.2.x
213+ ----------------------------------------------------------
214+
215+ net.sf.j2s.core_3.2.1.jar replaces net.sf.j2s.core_3.1.1.jar
216+
217+
65218 These versions differ only in their internal workings relative to Eclipse (and new bug fixes).
66219
67220 Most importantly, the requirement that the .project file be changed to
@@ -172,28 +325,22 @@ If your source code is not all already in src/, navigate to the project...proper
172325Java Build Path...source and add all the source directories you need.
173326
174327Note that your project must not include any Jar file-based dependencies.
175- All source code must be available. (Source code from decompiling .class files will work,
176- but it is not automatic, and we have not explored that option yet.)
328+ All source code must be available. (Source code from decompiling .class files will work.)
177329
178330---------------------------------------------------------------------
179331Installing the SwingJS JavaScript version of the Java Virtual Machine
180332---------------------------------------------------------------------
181333
182- Chrome users should consider using WebServer for Chrome to serve local files.
334+ Chrome users should consider using WebServer for Chrome to serve local files. It is very
335+ simple to set up.
183336
184337https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en
185338
186- It is very simple to set up.
187-
188- Firefox users need only set the about:config flag:
189-
190- security.fileuri.strict_origin_policy
191-
192- to "false".
193339
194340All of the JavaScript produced will be in the project site/ directory.
195341You must prepopulate this site with all the JavaScript required by the
196- SwingJS JavaScript version of the JVM. The most recent version of site/ is at
342+ JavaScript version of the JVM. The most recent version of site/ is at
343+ >>>>>>> branch 'hanson1' of https://github.com/BobHanson/java2script.git
197344
198345https://github.com/BobHanson/java2script/blob/master/sources/net.sf.j2s.core/dist/swingjs/SwingJS-site.zip?raw=true
199346
0 commit comments