MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

OMVS Java

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
sjetty
Beginner


Joined: 28 Feb 2017
Posts: 8
Topics: 2

PostPosted: Fri Sep 15, 2017 11:00 am    Post subject: OMVS Java Reply with quote

Hi All,

Can someone please help me to run java on OMVS.

Thanks,
Siva.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Fri Sep 15, 2017 11:04 am    Post subject: Reply with quote

sjetty,

Did you try this ?

https://www.ibm.com/developerworks/community/blogs/MartinPacker/entry/z_os_unix_system_services?lang=en
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sjetty
Beginner


Joined: 28 Feb 2017
Posts: 8
Topics: 2

PostPosted: Fri Sep 15, 2017 11:09 am    Post subject: Reply with quote

Hi Kolusu,

Thanks for information. I followed the instructions as mentioned to compile the HelloWorld.java program, however it is throwing errors saying that main() and all other java keywords are invalid. I checked java1.7.0_64 is installed in our shop. Is there anything else I need to do to compile java pgm.

Thanks,
Sivakumar Jetty.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Fri Sep 15, 2017 11:22 am    Post subject: Reply with quote

sjetty,

well you need to make sure you have the right path. To find the right path.

1. Issue TSO ISH or simply ISH depending on how your shop is configured
2. Change the path name to etc/profile
3. You will see a text file and there look for PATH environment variable.
4. COPY the PATH name and EXPORT (the last 2 lines)
5. Exit

Now go back to example show in the link and then issue the path and export command before compiling (step 9 in that link)
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sjetty
Beginner


Joined: 28 Feb 2017
Posts: 8
Topics: 2

PostPosted: Mon Sep 18, 2017 10:43 am    Post subject: Reply with quote

Hi Kolusu,

After searching path in etc/profile I found below path.

Code:

BROWSE    /etc/profile                                      CHARS 'path' found
 Command ===>                                                  Scroll ===> PAGE
# ======================================================================       
# Execution path                                                               
# ======================================================================       
PATH=.:/usr/lpp/java/J7.0_64/bin:/bin:/usr/sbin:/usr/lpp/coz/bin               
export PATH                                                                     
# ======================================================================       



After entering path ,export command in OMVS I tried to complie my java pgm, but still I am getting same error.

Code:

$ PATH=.:/usr/lpp/java/J7.0_64/bin:/bin:/usr/sbin:/usr/lpp/coz/bin             
$ export PATH                                                                   
$ javac test.java                                                               
test.java:3: error: illegal character: \168                                     
     public static void main(String args[])                                     
                                         Â¬                                     
test.java:3: error: illegal start of type                                       
     public static void main(String args[])                                     
                                          ¬                                     
test.java:3: error: <identifier> expected                                       
     public static void main(String args[])                                     
                                           Â¬                                   
test.java:4: error: ';' expected                                               
     {                                                                         
      ¬                                                                         
test.java:5: error: illegal start of type                                       
        System.out.println("hello");                                           
              ¬                                                                 
test.java:5: error: ';' expected                                               
        System.out.println("hello");                                           
                  ¬                                                             
test.java:5: error: invalid method declaration; return type required           
        System.out.println("hello");                                           
                   Â¬                                                           
test.java:5: error: illegal start of type                                       
        System.out.println("hello");                                           
                           Â¬                                                   
test.java:7: error: class, interface, or enum expected                         
   }                                                                           
   Â¬                                                                           
9 errors             


Can you please let me if I am missing anything here.

Thank,
Sivakumar.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Mon Sep 18, 2017 12:17 pm    Post subject: Reply with quote

sjetty,

You just need till bin portion and the rest is not needed.

PATH=/usr/lpp/java/J7.0_64/bin
$ export PATH

Also looks like you sent a file from PC side and it resulted in Byte order mark. You can force it to use UTF8 Encoding by the following

Code:

javac -encoding UTF8 test.java


Try with a simple program first and then you can play around stuff later.

Follow this

1. Type OMVS. (If your userid has been set up to use Unix System Services it should start you in a directory (mine being "/u/userid").

2. Since you already created a directory we can skip the creating of directory and sample program

3. Make sure your HELLO.JAVA has the following

Code:

public class Hello{
  public static void main(String args[]){
    System.out.println("Welcome!");
  }
}


4. Issue the command the following command and press enter
Code:

PATH=/usr/lpp/java/J7.0_64/bin


5. Issue the command the following command and press enter
Code:
export PATH 


6. Compile the resulting java with "javac -encoding UTF8 Hello.java".

7. Run the compiled java bytecode with "java Hello".
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sjetty
Beginner


Joined: 28 Feb 2017
Posts: 8
Topics: 2

PostPosted: Tue Sep 19, 2017 10:34 am    Post subject: Reply with quote

Hi Kolusu,

I have used the path till bin and issued PATH and EXPORT command in the directory where i have my java code.After issuing command javac -encoding UTF8 test.java, it throwed aroubd 90 errors.

Below code i have written in ISHELL and not transmitted from PC.

Code:

EDIT       /u/uid/siva/test.java                          Columns 00001 00072
Command ===>                                                  Scroll ===> CSR
****** ***************************** Top of Data ******************************
=PROF> ....JAVA (VARIABLE - 255)....RECOVERY ON....NUMBER OFF..................
=PROF> ....CAPS OFF....HEX OFF....NULLS ON STD....TABS OFF....SETUNDO STG......
=PROF> ....AUTOSAVE ON....AUTONUM OFF....AUTOLIST OFF....STATS OFF.............
=PROF> ....PROFILE UNLOCK....IMACRO NONE....PACK OFF....NOTE ON................
=PROF> ....HILITE DEFAULTPAREN CURSOR FIND.....................................
000001 class test                                                             
000002    {                                                                   
000003      public static void main(String args[])                             
000004      {                                                                 
000005         System.out.println("hello");                                   
000006      }                                                                 
000007    }                                                                   
****** **************************** Bottom of Data ****************************


I am still facing the same issue. Is it like that my path is not is being properly, if so how can we verify whether the path is set correctly or not.

Thanks,
Siva
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Tue Sep 19, 2017 7:21 pm    Post subject: Reply with quote

sjetty wrote:
Hi Kolusu,

I have used the path till bin and issued PATH and EXPORT command in the directory where i have my java code.After issuing command javac -encoding UTF8 test.java, it throwed aroubd 90 errors.


Siva,


Stop using such phrases. You compile and you get errors, that's all and there is NO throwing involved.

Secondly, the issue is with how you are copying and pasting. Looks like your COPY and PASTE is messing up the Square brackets or inserting additional characters at the end.

Make sure that you have X'AD' for [ and X'BD' for ]

Type HX7 on line 1 and see if you have any other junk characters at the end of each line

this is how your program should be when you turn on HEX

Code:

 class test                                       
 898AA4A8AA4444444444444444444444444444444444444444
 33122035230000000000000000000000000000000000000000
---------------------------------------------------
    {                                             
 444C4444444444444444444444444444444444444444444444
 00000000000000000000000000000000000000000000000000
---------------------------------------------------
      public static void main(String args[])       
 444449A89884AA8A884A988498894EA98984898AAB54444444
 0000074239302313930569404195D23995701972DDD0000000
---------------------------------------------------
      {                                           
 44444C44444444444444444444444444444444444444444444
 00000000000000000000000000000000000000000000000000
---------------------------------------------------
         System.out.println("hello");             
 44444444EAAA8949AA49989A99478899975544444444444444
 00000000282354B643B7995335DF85336FDE00000000000000
---------------------------------------------------
      }                                           
 44444D44444444444444444444444444444444444444444444
 00000000000000000000000000000000000000000000000000
---------------------------------------------------
    }                                             
 444D4444444444444444444444444444444444444444444444
 00000000000000000000000000000000000000000000000000

_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sjetty
Beginner


Joined: 28 Feb 2017
Posts: 8
Topics: 2

PostPosted: Thu Sep 21, 2017 10:59 am    Post subject: Reply with quote

Hi Kolusu,

When in HEX On I could see X'BA' for [ and X'BB' for ] and not X'AD' for [ and X'BD' for ].

Code:



000002   {                                                                     
       44C444444444444444444444444444444444444444444444444444444444444444444444
       000000000000000000000000000000000000000000000000000000000000000000000000
------------------------------------------------------------------------------
000003     public static void main(String args[])                             
       44449A89884AA8A884A988498894EA98984898ABB5444444444444444444444444444444
       000074239302313930569404195D23995701972ABD000000000000000000000000000000
------------------------------------------------------------------------------
000004     {                                                                   
       4444C4444444444444444444444444444444444444444444444444444444444444444444
       000000000000000000000000000000000000000000000000000000000000000000000000
------------------------------------------------------------------------------
000005     System.out.println("Hello! World");                                 
       4444EAAA8949AA49989A9947C899954E9998755444444444444444444444444444444444
       0000282354B643B7995335DF85336A066934FDE000000000000000000000000000000000
------------------------------------------------------------------------------



Even I tried to check the values for [] in a flat file. Still I don't see X'AD' for [ and X'BD' for ].

Code:

****** ***************************** To
000001 []                             
       BB444444444444444444444444444444
       AB000000000000000000000000000000
---------------------------------------
000002 SIVAKUMAR JETTY             ,ABI
       ECECDEDCD4DCEEE44444444444446CCC
       2951244190153380000000000000B129



Can you please let me know how can I get the correct values for []. So that my pgm would compile.

Thanks,
Sivakumar Jetty.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12358
Topics: 75
Location: San Jose

PostPosted: Thu Sep 21, 2017 12:39 pm    Post subject: Reply with quote

sjetty wrote:
Hi Kolusu,

When in HEX On I could see X'BA' for [ and X'BB' for ] and not X'AD' for [ and X'BD' for ].


Sjetty,

Looks like your mainframe encoding scheme is not 1047 or 0037.


sjetty wrote:

Can you please let me know how can I get the correct values for []. So that my pgm would compile.

Thanks,
Sivakumar Jetty.



Simply type HX as the line command and over type the value the X'BD' and save it and you should be able to compile.
_________________
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group