Upload file to AS 400

Do you have any ideas to execute one .jar file, which has been created in Win 7 environment, within AS 400 OS? How to upload the relevant file to AS 400 from Win 7?
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

A jar file is executed the same way on any system - by running it with a JVM. Your AS400 box would need one.

The safest way to transfer a file to a Unix server is using secure FTP
Gary PattersonVP Technology / Senior Consultant Commented:
Even though the AS/400 (iSeries, IBM i) isn't a Unix box (it does have an AIX emulation environment called PASE, though), FTP is one of the alternatives for transferring files.  sftp is part of an optionally-installable LPP, so it is not necessarily installed on every system.

Other options include IBM i Navigator (a component of IBM i Access for Windows), which provides a GUI drag-and drop interface to the IBM.

IBM i NetServer is a SMB/CIFS-compatible file transfer interface that is compatible with Windows file sharing, so if NetServer is configured, you can just connect to the IBM i Integrated File System using Windows Explorer, or even map a Windows drive to a share in the IFS.

Java is also an optionally-installable licensed program product on IBM i.  To determine if Java is installed GO LICPGM, select option 10, and look for JDK and J2SE or Java SE in the Description.  You can also check for Java by going into Qshell (type QSH and press enter), and typing "java -version" on the QSH Command Entry line.

Java programs can be executed from the native IBM i environment, or from the Qshell environment, or PASE environment (CALL QP2TERM).  Qshell and PASE  provide an AIX compatible command shell, is are the most common ways to work with Java on IBM i.

In QSH or PASE, you just use the "java" command, like you would in any other environment:

java -jar jar-file

Of course you'll have to have your classpath set up correctly, just like in any Java environment.

Here is a nice detailed article that may be of some help:


- Gary

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Even though the AS/400 (iSeries, IBM i) isn't a Unix box (it does have an AIX emulation environment called PASE, though)

Thanks for that clarification
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

Gary PattersonVP Technology / Senior Consultant Commented:
@CEHJ:  It is a common misconception that AS/400 / iSeries / are Unix boxes.  I think people (that don't work on IBM midrange) tend to put operating systems into two categories:  Windows and Unix/Linux.  

But IBM S/38, AS/400, and iSeries hardware run an operating system that was created from the ground up, and is not at all related to Unix.  It has changed names over time: CPF, OS/400, and i5/OS.  

Now that IBM has merged the "iSeries" and "pSeries" hardware into one hardware line, we now just have shared Power Systems hardware that runs the IBM i operating system.  The same Power Systems hardware can also run AIX and Linux.  It is also possible to run multiple partitions in a single systems, each running a different OS.

To make things even more confusing, IBM i offers an embedded AIX environment called PASE that can run AIX binaries inside and IBM i partition without the need to create a separate AIX partition.  Closest parallel I can come up with is cygwin in Windows.
Shalom CarmelCTOCommented:
Java classes and jars must reside in the Integrated File System (IFS) and not in the libraries that AS400 programmers are familiar with.

If you transfer the jar file via FTP, you must place it in a folder in IFS and use binary mode to copy.
Because of incompatibility with the rest of the world, many graphical FTP clients will fail miserably with this platform, so I recommend using the command line ftp client every windows has.

Your FTP commands would look like

quote site namefmt 1
quote site listfmt 1
cd /yourfolder
put yourjarfile.jar

On the AS400 side, after login you get to the native "shell" which is the menu system.
While it is possible to execute a jar file via the RUNJVA command, an easier way is to invoke the qshell environment like Gary mentioned, and execute from there.
For large jar files, the first execution will take much longer than the next ones because the server creates intermediate code for the entire jar.
Depending on the server hardware and OS version, you may see that the AS400 java execution time is inferior to even a weak intel server, but that's normal :(
Gary PattersonVP Technology / Senior Consultant Commented:

One note about this comment

For large jar files, the first execution will take much longer than the next ones because the server creates intermediate code for the entire jar.

That was true in older version of the operating system, but in current versions of the OS, native code objects are no longer generated - the JVM works just like it does on other platforms and either interprets Java code or uses JIT.

JIT was first available in V4R4, but performance wasn't good.  In V5R2, JIT just about caught up to native compilation, and most of the time generating a native code object wasn't a benefit after that.

With the "new" IBM Technology for Java JVM, native object creation (CRTJVAPGM) is no longer even an option.   IT4J was introduced as an optional JVM in V5R4, became the default JVM in V6R1 (native JVM was still available though), and is the only JVM supplied by IBM in V7R1 and later.
HuaMin ChenProblem resolverAuthor Commented:
Thanks all.
Does it mean I should use relevant FTP account in AS 400, to upload the JAR files?
Shalom CarmelCTOCommented:
Any user on the AS400 can by default connect via FTP, but it is best to have a dedicated upload user profile.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.