Results 1 to 3 of 3
  1. #1
    shahrukh is offline Member
    Join Date
    Jan 2011
    Posts
    1
    Rep Power
    0

    Default Java command line Windows vs Linux

    okay so i made a batch file on my windows xp for testing purposes when i made myself a java program
    Java Code:
    @echo off
    title Source 474
    java -Xmx1200m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.08-ga-bin.jar server
    its basically a server thing that i made in java

    now i want to host the server on my linux machine
    how would i convert this DOS to linux
    to be more specific, Ubuntu Server 10.10

    now i installed JDK, JRE, and i have a mysql server running on my Linux
    so im pretty sure i meet all the prerequisites

    now im having problems with the linux shell script so far i have
    Java Code:
    #!bash/bin/
    java -Xmx1200m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.08-ga-bin.jar server
    sleep
    and that doesnt seem to work

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,352
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by shahrukh View Post
    okay so i made a batch file on my windows xp for testing purposes when i made myself a java program
    Java Code:
    @echo off
    title Source 474
    java -Xmx1200m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.08-ga-bin.jar server
    its basically a server thing that i made in java

    now i want to host the server on my linux machine
    how would i convert this DOS to linux
    to be more specific, Ubuntu Server 10.10

    now i installed JDK, JRE, and i have a mysql server running on my Linux
    so im pretty sure i meet all the prerequisites

    now im having problems with the linux shell script so far i have
    Java Code:
    #!bash/bin/
    java -Xmx1200m -cp .;./jython.jar;./MySql/mysql-connector-java-3.0.08-ga-bin.jar server
    sleep
    and that doesnt seem to work
    Use colons ':' instead of semi colons ';' in you classpath as the separator character.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    953
    Rep Power
    5

    Default

    You want
    Java Code:
    #!/bin/bash
    and not
    Java Code:
    [COLOR="Red"]#!bash/bin/
    [/COLOR]
    Try replacing your semicolons with colons. Also, you're probably better off putting in absolute paths (starting from the filesystem root -- "/") rather than relative paths (starting from the current directory -- "."). Once you've created your shell script, make sure you make it executable (chmod 755 <scriptname>). Then either put it into a directory that is already on your $PATH or make sure that you invoke it with an explicit path. In other words, if it's called "myscript" and it's in your current directory, you probably can't just type "myscript", as the current directory is probably not on your $PATH. Type "./myscript" instead.

    -Gary-

Similar Threads

  1. Replies: 3
    Last Post: 01-11-2011, 11:45 PM
  2. Replies: 3
    Last Post: 08-25-2010, 10:21 AM
  3. Replies: 2
    Last Post: 07-02-2010, 02:20 PM
  4. Replies: 2
    Last Post: 03-31-2010, 12:26 AM
  5. calling linux command line in java
    By fangzhong in forum New To Java
    Replies: 0
    Last Post: 02-03-2008, 04:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •