View previous topic :: View next topic |
Author |
Message |
sjetty Beginner
Joined: 28 Feb 2017 Posts: 8 Topics: 2
|
Posted: Fri Sep 15, 2017 11:00 am Post subject: OMVS Java |
|
|
Hi All,
Can someone please help me to run java on OMVS.
Thanks,
Siva. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
sjetty Beginner
Joined: 28 Feb 2017 Posts: 8 Topics: 2
|
Posted: Fri Sep 15, 2017 11:09 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Fri Sep 15, 2017 11:22 am Post subject: |
|
|
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
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sjetty Beginner
Joined: 28 Feb 2017 Posts: 8 Topics: 2
|
Posted: Mon Sep 18, 2017 10:43 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Mon Sep 18, 2017 12:17 pm Post subject: |
|
|
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
6. Compile the resulting java with "javac -encoding UTF8 Hello.java".
7. Run the compiled java bytecode with "java Hello". _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sjetty Beginner
Joined: 28 Feb 2017 Posts: 8 Topics: 2
|
Posted: Tue Sep 19, 2017 10:34 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Sep 19, 2017 7:21 pm Post subject: |
|
|
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
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
sjetty Beginner
Joined: 28 Feb 2017 Posts: 8 Topics: 2
|
Posted: Thu Sep 21, 2017 10:59 am Post subject: |
|
|
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 |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Sep 21, 2017 12:39 pm Post subject: |
|
|
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
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
|
|