Creating Executables Jar files after compiling my NetRexx program

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating Executables Jar files after compiling my NetRexx program

Quique Britto
Hi all,

I seem not to be able to create executable jar files for my compiled and working programs written in NetRexx, none of them.
Writing  the Helloworld program in native Java and compiling I can create an executable file by perfoming the flwg.:

1. create a manifest file which contains.:
    Manifest-Version: 1.0
    Main-Class: Helloworld
    Class-path .

2. fm the comand line i type and execute
    jar cvfm Helloworld.jar manifest.mft *.class

This creates the jar file which can be executed by typing java -jar Helloworld.jar or by double clicking the icon fm the desktop.


NOW:

When I compile (without errors) a NetRexx program fm jEdit, one of which compiles and executes ok I try to create and executable Jar using the above method which works but I receive the msg:

Execption in thread "main" java.lang.NoClassDefFoundError:


 I load and compile the java code generated fm the NetRexx program using jEdit but I receive the msg:

Error: Unexpected character found in source: '{' (hexadecimal encoding: 007B)
Compilation of 'xxx.java.keep' failed


This happens on my NetRexx programs, I can run them fm within jEdit but not fm the command line.


Any help will be appreciated
Quique




_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Fernando Cassia-2
On Fri, Jul 22, 2011 at 13:58, Quique Britto <[hidden email]> wrote:
> I seem not to be able to create executable jar files for my compiled and
> working programs written in NetRexx, none of them.

Did you try this?

http://one-jar.sourceforge.net/version-0.96/

FC
_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

RE: Creating Executables Jar files after compiling myNetRexx program

measel
In reply to this post by Quique Britto

Don’t try to set the classpath with the manifest and include the Netrexx runtime into your jar.

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of Quique Britto
Sent: Friday, July 22, 2011 11:59 AM
To: [hidden email]
Subject: [Ibm-netrexx] Creating Executables Jar files after compiling myNetRexx program

 

Hi all,

I seem not to be able to create executable jar files for my compiled and working programs written in NetRexx, none of them.
Writing  the Helloworld program in native Java and compiling I can create an executable file by perfoming the flwg.:

1. create a manifest file which contains.:
    Manifest-Version: 1.0
    Main-Class: Helloworld
    Class-path .

2. fm the comand line i type and execute
    jar cvfm Helloworld.jar manifest.mft *.class

This creates the jar file which can be executed by typing java -jar Helloworld.jar or by double clicking the icon fm the desktop.


NOW:

When I compile (without errors) a NetRexx program fm jEdit, one of which compiles and executes ok I try to create and executable Jar using the above method which works but I receive the msg:

Execption in thread "main" java.lang.NoClassDefFoundError:


 I load and compile the java code generated fm the NetRexx program using jEdit but I receive the msg:

Error: Unexpected character found in source: '{' (hexadecimal encoding: 007B)
Compilation of 'xxx.java.keep' failed


This happens on my NetRexx programs, I can run them fm within jEdit but not fm the command line.


Any help will be appreciated
Quique



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

ThSITC
In reply to this post by Quique Britto
Hello Quicque,

   That is, as far as I do know (with my limited experience >grin<) one of the MOST ANNOYING
dis-behaviour's in the current NetRexx/Java part of the *universe* (of IT-Technonlogy, *if something as
this does exist at all* ..... <shit, grin>).

   The only way I personally did find aroung to overcome this behaviour:

1.) Compile your NetRexx/Java Program
2.) PUT it into your JAR file, immediately after compilation.
3.) PULL your newly generated JAR to ... \javaxxxx\jrel\lib\ext\

That's the ONLY method I did find to work in all cases.

No idea, Kermit, please listen:

Why (the hell) should be following the Java IMPLICIT rules  (as givedn and documented by Java DESIGN)
be a *BAD* idea ???

Thomas Schneider.
==================================================================================

Am 22.07.2011 18:58, schrieb Quique Britto:
Hi all,

I seem not to be able to create executable jar files for my compiled and working programs written in NetRexx, none of them.
Writing  the Helloworld program in native Java and compiling I can create an executable file by perfoming the flwg.:

1. create a manifest file which contains.:
    Manifest-Version: 1.0
    Main-Class: Helloworld
    Class-path .

2. fm the comand line i type and execute
    jar cvfm Helloworld.jar manifest.mft *.class

This creates the jar file which can be executed by typing java -jar Helloworld.jar or by double clicking the icon fm the desktop.


NOW:

When I compile (without errors) a NetRexx program fm jEdit, one of which compiles and executes ok I try to create and executable Jar using the above method which works but I receive the msg:

Execption in thread "main" java.lang.NoClassDefFoundError:


 I load and compile the java code generated fm the NetRexx program using jEdit but I receive the msg:

Error: Unexpected character found in source: '{' (hexadecimal encoding: 007B)
Compilation of 'xxx.java.keep' failed


This happens on my NetRexx programs, I can run them fm within jEdit but not fm the command line.


Any help will be appreciated
Quique



_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


--
Thomas Schneider (www.thsitc.com)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Kermit Kiser
In reply to this post by Quique Britto
Hi Quique -

If you want more help with these problems (You gave two error messages, so it looks like two separate problems to me.), you may need to provide some sample code to recreate the problem and a directory/file list from your jar file.

I can think of at least three possible causes for the first message: a case mismatch in the classnames, invalid directory structure in the jar file, or use of Rexx type variables or functions without including the NetRexx runtime in your jar file. You can solve the latter by adding the NetRexx runtime jar to the Java extensions directory ($JAVA_HOME$\lib\ext) as Thomas suggested but that will break the NetRexxScript plugin of jEdit by causing class loader conflicts. Alternately you can make your class binary or unzip the NetRexx runtime jar in your program's directory before creating the jar file and your program will run on any Java installation then without needing NetRexx to be installed. The problem is caused by the little known fact that Java ignores any classpath variables or parameters when you execute a jar file with "java -jar". You may be able to bypass that problem by putting the jar in your classpath and not using "-jar" when you execute it:

java -cp Helloworld.jar;NetRexxR.jar  Helloworld

The second message indicates a character set problem. You might be able to fix it by renaming the file to xxx.java before compiling or making sure you are using UTF8 encoding for the file. George would know more on that one.

-- Kermit


On 7/22/2011 9:58 AM, Quique Britto wrote:
Hi all,

I seem not to be able to create executable jar files for my compiled and working programs written in NetRexx, none of them.
Writing  the Helloworld program in native Java and compiling I can create an executable file by perfoming the flwg.:

1. create a manifest file which contains.:
    Manifest-Version: 1.0
    Main-Class: Helloworld
    Class-path .

2. fm the comand line i type and execute
    jar cvfm Helloworld.jar manifest.mft *.class

This creates the jar file which can be executed by typing java -jar Helloworld.jar or by double clicking the icon fm the desktop.


NOW:

When I compile (without errors) a NetRexx program fm jEdit, one of which compiles and executes ok I try to create and executable Jar using the above method which works but I receive the msg:

Execption in thread "main" java.lang.NoClassDefFoundError:


 I load and compile the java code generated fm the NetRexx program using jEdit but I receive the msg:

Error: Unexpected character found in source: '{' (hexadecimal encoding: 007B)
Compilation of 'xxx.java.keep' failed


This happens on my NetRexx programs, I can run them fm within jEdit but not fm the command line.


Any help will be appreciated
Quique



_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Kermit Kiser
In reply to this post by ThSITC
I have heard that when your only tool is a hammer, all problems look like a nail. It is certainly easier to put your programs in the Java extensions directory, where they are always loaded and searched whether running or not, than to learn the proper use of classpaths. Of course you will cause other problems by doing so. Here is the warning from the Oracle Java documentation about Java extensions:
-----

Since installed extensions extend the platform's core API, use them judiciously. They are rarely appropriate for interfaces used by a single, or small set of applications.

Furthermore, since the symbols defined by installed extensions will be visible in all Java processes, care should be taken to ensure that all visible symbols follow the appropriate "reverse domain name" and "class hierarchy" conventions. For example, com.mycompany.MyClass.
-----

In this case, if Quique puts his Helloworld jar in the extensions directory, all other Helloworld programs will fail.

Extensions=BAD idea. Especially when an environment (like jEdit) with a custom classloader is trying to load it's own version of the classes. Instant conflict!

-- Kermit



On 7/22/2011 11:46 PM, Thomas Schneider wrote:
Hello Quicque,

   That is, as far as I do know (with my limited experience >grin<) one of the MOST ANNOYING
dis-behaviour's in the current NetRexx/Java part of the *universe* (of IT-Technonlogy, *if something as
this does exist at all* ..... <shit, grin>).

   The only way I personally did find aroung to overcome this behaviour:

1.) Compile your NetRexx/Java Program
2.) PUT it into your JAR file, immediately after compilation.
3.) PULL your newly generated JAR to ... \javaxxxx\jrel\lib\ext\

That's the ONLY method I did find to work in all cases.

No idea, Kermit, please listen:

Why (the hell) should be following the Java IMPLICIT rules  (as givedn and documented by Java DESIGN)
be a *BAD* idea ???

Thomas Schneider.
==================================================================================

Am 22.07.2011 18:58, schrieb Quique Britto:
Hi all,

I seem not to be able to create executable jar files for my compiled and working programs written in NetRexx, none of them.
Writing  the Helloworld program in native Java and compiling I can create an executable file by perfoming the flwg.:

1. create a manifest file which contains.:
    Manifest-Version: 1.0
    Main-Class: Helloworld
    Class-path .

2. fm the comand line i type and execute
    jar cvfm Helloworld.jar manifest.mft *.class

This creates the jar file which can be executed by typing java -jar Helloworld.jar or by double clicking the icon fm the desktop.


NOW:

When I compile (without errors) a NetRexx program fm jEdit, one of which compiles and executes ok I try to create and executable Jar using the above method which works but I receive the msg:

Execption in thread "main" java.lang.NoClassDefFoundError:


 I load and compile the java code generated fm the NetRexx program using jEdit but I receive the msg:

Error: Unexpected character found in source: '{' (hexadecimal encoding: 007B)
Compilation of 'xxx.java.keep' failed


This happens on my NetRexx programs, I can run them fm within jEdit but not fm the command line.


Any help will be appreciated
Quique



_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


--
Thomas Schneider (www.thsitc.com)
_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Quique Britto
In reply to this post by Kermit Kiser
ok, I can now execute fm the command line using yr method java -cp Helloworld.jar;NetRexxR.jar  Helloworld and have created a bat file (shortcut) on my desktop to be able run it fm an Icon.

Many thks.

PS: do we know why double clicking the executable jar will not work and the above yes?


Quique






On 23 July 2011 23:04, Kermit Kiser <[hidden email]> wrote:
Hi Quique -

If you want more help with these problems (You gave two error messages, so it looks like two separate problems to me.), you may need to provide some sample code to recreate the problem and a directory/file list from your jar file.

I can think of at least three possible causes for the first message: a case mismatch in the classnames, invalid directory structure in the jar file, or use of Rexx type variables or functions without including the NetRexx runtime in your jar file. You can solve the latter by adding the NetRexx runtime jar to the Java extensions directory ($JAVA_HOME$\lib\ext) as Thomas suggested but that will break the NetRexxScript plugin of jEdit by causing class loader conflicts. Alternately you can make your class binary or unzip the NetRexx runtime jar in your program's directory before creating the jar file and your program will run on any Java installation then without needing NetRexx to be installed. The problem is caused by the little known fact that Java ignores any classpath variables or parameters when you execute a jar file with "java -jar". You may be able to bypass that problem by putting the jar in your classpath and not using "-jar" when you execute it:



The second message indicates a character set problem. You might be able to fix it by renaming the file to xxx.java before compiling or making sure you are using UTF8 encoding for the file. George would know more on that one.

-- Kermit



On 7/22/2011 9:58 AM, Quique Britto wrote:
Hi all,

I seem not to be able to create executable jar files for my compiled and working programs written in NetRexx, none of them.
Writing  the Helloworld program in native Java and compiling I can create an executable file by perfoming the flwg.:

1. create a manifest file which contains.:
    Manifest-Version: 1.0
    Main-Class: Helloworld
    Class-path .

2. fm the comand line i type and execute
    jar cvfm Helloworld.jar manifest.mft *.class

This creates the jar file which can be executed by typing java -jar Helloworld.jar or by double clicking the icon fm the desktop.


NOW:

When I compile (without errors) a NetRexx program fm jEdit, one of which compiles and executes ok I try to create and executable Jar using the above method which works but I receive the msg:

Execption in thread "main" java.lang.NoClassDefFoundError:


 I load and compile the java code generated fm the NetRexx program using jEdit but I receive the msg:

Error: Unexpected character found in source: '{' (hexadecimal encoding: 007B)
Compilation of 'xxx.java.keep' failed


This happens on my NetRexx programs, I can run them fm within jEdit but not fm the command line.


Any help will be appreciated
Quique



_______________________________________________ Ibm-netrexx mailing list

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/




_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Fernando Cassia-2
Maybe I´m missing something, but I´d like to know why my suggestion of
using one-jar to package apps as a single jar was ignored. Doesn´t it
work with NetRexx code?

Double-clicking on a jar file is the Right Way to run apps. Or let me
rephrase it, any properly packaged Java app should include the default
class in its manifest, be packaged into a single JAR file, and should
be able to be run from Java -jar appname.jar (or, on Windows, double
clicking on the Jar file)

Creating a .cmd script to start apps is SO 1990s that it irks me beyond belief.

FC

On Sun, Jul 24, 2011 at 08:44, Quique Britto <[hidden email]> wrote:
>
> Many thks.
>
> PS: do we know why double clicking the executable jar will not work and the
> above yes?
>
>
> Quique



--
"Si, yo creo en los objetos. Inclusive más que en los seres humanos.
Creo que son más fieles ¿no?. Porque, claro, los seres humanos pueden
traicionarte, pero los objetos no, a los objetos
los traicionamos nosotros."
                                     -Manuel Mujica Laines

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Quique Britto
will check the one-jar package within the week but I needed an urgent solution, this one helps me out but I do want/need to be able to double click a Jar file with classes created using Netrexx.

As mentioned in 1st email, when I wrote the helloworld in pure Java and compiled, I created the jar file and this did work so I know it's a Netrexx thing or related.

Quique



On 24 July 2011 20:54, Fernando Cassia <[hidden email]> wrote:
Maybe I´m missing something, but I´d like to know why my suggestion of
using one-jar to package apps as a single jar was ignored. Doesn´t it
work with NetRexx code?

Double-clicking on a jar file is the Right Way to run apps. Or let me
rephrase it, any properly packaged Java app should include the default
class in its manifest, be packaged into a single JAR file, and should
be able to be run from Java -jar appname.jar (or, on Windows, double
clicking on the Jar file)

Creating a .cmd script to start apps is SO 1990s that it irks me beyond belief.

FC

On Sun, Jul 24, 2011 at 08:44, Quique Britto <[hidden email]> wrote:
>
> Many thks.
>
> PS: do we know why double clicking the executable jar will not work and the
> above yes?
>
>
> Quique



--
"Si, yo creo en los objetos. Inclusive más que en los seres humanos.
Creo que son más fieles ¿no?. Porque, claro, los seres humanos pueden
traicionarte, pero los objetos no, a los objetos
los traicionamos nosotros."
                                     -Manuel Mujica Laines

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/



_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Kermit Kiser
Quique --

You can run this as an executable jar if you put a classpath to the NetRexx runtime lib in your manifest:

Main-Class: Helloworld
Class-Path: NetRexxR.jar

(Note that the manifest file must be created with UTF8 encoding and must end with a blank line.)

This will also allow you to start it by double clicking - I tested that to make sure. (You may not see anything with Helloworld since the jar association probably won't open a console window.)

If you don't use the NetRexx runtime library in your program then it is a pure Java program and you don't need the classpath to the runtime lib. Just make your code "options binary" without using any Rexx type variables or any NetRexx special functions like "say". Of course, that eliminates much of the advantage of programming in NetRexx as far as I can see! NetRexx is much superior to Java but it does require access to the runtime library in addition to the standard Java stuff. I hope that helps.

-- Kermit


On 7/24/2011 12:11 PM, Quique Britto wrote:
will check the one-jar package within the week but I needed an urgent solution, this one helps me out but I do want/need to be able to double click a Jar file with classes created using Netrexx.

As mentioned in 1st email, when I wrote the helloworld in pure Java and compiled, I created the jar file and this did work so I know it's a Netrexx thing or related.

Quique



On 24 July 2011 20:54, Fernando Cassia <[hidden email]> wrote:
Maybe I´m missing something, but I´d like to know why my suggestion of
using one-jar to package apps as a single jar was ignored. Doesn´t it
work with NetRexx code?

Double-clicking on a jar file is the Right Way to run apps. Or let me
rephrase it, any properly packaged Java app should include the default
class in its manifest, be packaged into a single JAR file, and should
be able to be run from Java -jar appname.jar (or, on Windows, double
clicking on the Jar file)

Creating a .cmd script to start apps is SO 1990s that it irks me beyond belief.

FC

On Sun, Jul 24, 2011 at 08:44, Quique Britto <[hidden email]> wrote:
>
> Many thks.
>
> PS: do we know why double clicking the executable jar will not work and the
> above yes?
>
>
> Quique



--
"Si, yo creo en los objetos. Inclusive más que en los seres humanos.
Creo que son más fieles ¿no?. Porque, claro, los seres humanos pueden
traicionarte, pero los objetos no, a los objetos
los traicionamos nosotros."
                                     -Manuel Mujica Laines

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: Creating Executables Jar files after compiling my NetRexx program

Quique Britto
works!!!

thks to all.
Quique



On 24 July 2011 22:31, Kermit Kiser <[hidden email]> wrote:
Quique --

You can run this as an executable jar if you put a classpath to the NetRexx runtime lib in your manifest:

Main-Class: Helloworld
Class-Path: NetRexxR.jar

(Note that the manifest file must be created with UTF8 encoding and must end with a blank line.)

This will also allow you to start it by double clicking - I tested that to make sure. (You may not see anything with Helloworld since the jar association probably won't open a console window.)

If you don't use the NetRexx runtime library in your program then it is a pure Java program and you don't need the classpath to the runtime lib. Just make your code "options binary" without using any Rexx type variables or any NetRexx special functions like "say". Of course, that eliminates much of the advantage of programming in NetRexx as far as I can see! NetRexx is much superior to Java but it does require access to the runtime library in addition to the standard Java stuff. I hope that helps.

-- Kermit



On 7/24/2011 12:11 PM, Quique Britto wrote:
will check the one-jar package within the week but I needed an urgent solution, this one helps me out but I do want/need to be able to double click a Jar file with classes created using Netrexx.

As mentioned in 1st email, when I wrote the helloworld in pure Java and compiled, I created the jar file and this did work so I know it's a Netrexx thing or related.

Quique



On 24 July 2011 20:54, Fernando Cassia <[hidden email]> wrote:
Maybe I´m missing something, but I´d like to know why my suggestion of
using one-jar to package apps as a single jar was ignored. Doesn´t it
work with NetRexx code?

Double-clicking on a jar file is the Right Way to run apps. Or let me
rephrase it, any properly packaged Java app should include the default
class in its manifest, be packaged into a single JAR file, and should
be able to be run from Java -jar appname.jar (or, on Windows, double
clicking on the Jar file)

Creating a .cmd script to start apps is SO 1990s that it irks me beyond belief.

FC

On Sun, Jul 24, 2011 at 08:44, Quique Britto <[hidden email]> wrote:
>
> Many thks.
>
> PS: do we know why double clicking the executable jar will not work and the
> above yes?
>
>
> Quique



--
"Si, yo creo en los objetos. Inclusive más que en los seres humanos.
Creo que son más fieles ¿no?. Porque, claro, los seres humanos pueden
traicionarte, pero los objetos no, a los objetos
los traicionamos nosotros."
                                     -Manuel Mujica Laines

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/


_______________________________________________ Ibm-netrexx mailing list [hidden email] Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/




_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/