Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run jar on IBM i (as400 / iSeries)

I'm working with IBM i (often called an AS/400 server).

Currently I have been able to create .CLASS files and run perfectly

in as400 Directory (I think it's called IFS or something like) a have my tree like:

/
+--Javacfd/
   +--bin/
      +--com/
         +---company/
             Class1.class
             Class2.class    
             Hello.class
             Server.class
             +---other/
                 Other.class
                 Another.class
                 Etc.class

When I run RUNJVA CLASS('com.company.Hello') Works well! Or RUNJVA CLASS('com.company.other.Other')

Now I need run a executable jar

In windows java -jar my-jar.jar Works well

I as400 I tried

RUNJVA CLASS('hello.Application') CLASSPATH(':\Javacfd\bin\my-jar.jar')    

I get

Exception in thread "main" java.lang.NoClassDefFoundError: hello.Application

RUNJVA CLASS('hello.Application') CLASSPATH('Javacfd\bin\my-jar.jar') 

I get

Exception in thread "main" java.lang.NoClassDefFoundError: hello.Application

RUNJVA CLASS('hello.Application') CLASSPATH('\Javacfd\bin\my-jar.jar') 

I get

Exception in thread "main" java.lang.NoClassDefFoundError: hello.Application

RUNJVA CLASS('hello.Application') 

I get

Exception in thread "main" java.lang.NoClassDefFoundError: hello.Application

Note hello is package and Application is a Main class. Jar file is locale in \Javacfd\bin\my-jar.jar

I'm doing wrong?

like image 759
jasilva Avatar asked Mar 16 '23 04:03

jasilva


1 Answers

Assuming the jar contains a proper manifest you specify the jar file on the RUNJVA command CLASS parameter:

RUNJVA CLASS('/Javacfd/bin/my-jar.jar')

You can also use the standard java tools and utilities through the Qshell interpreter:

QSH CMD('java -jar /Javacfd/bin/my-jar.jar')
like image 116
James Allman Avatar answered Mar 25 '23 04:03

James Allman