Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can you write simple Java code in a UNIX function and run it? See example....

966239Feb 17 2015 — edited Apr 1 2015

Hi,

I'm new to Java and I have a question.

Is there any possible way a simple script like the below would work in a UNIX function called from a shell script. I know you're not supposed to do this but can you?

Thanks in advance,

...

javatst() {

   $JAVA_HOME/bin/java  <<- _java

  public class HelloWorld {

  public static void main(String[] args) {

  System.out.println("Hello, World");

  }

  }

  _java

}

javatst

...

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 29 2015
Added on Feb 17 2015
8 comments
1,835 views