May 13, 2009

If possible , how to run .bat files in Linux ?

I got a file , called run.bat , which obviously runs something , in this case a client , in java code , to login for a game.

Now , since I'm using  Linux , I can't open the run.bat file. Tried to change it to run.sh, no results.

 

Help please ?

 

P.S.: I'm a totally new Linux user , and if this is a silly question , please just *politely* say so.

 

Thanks in advance.  

 

P.S.: My Linux is ( translated from Portuguese -> English , literally ) Linux Magic Box 12. 

you can also try to run virtualbox in your linux system and install windows...

you can also try to run virtualbox in your linux system and install windows in one of the virtual machine and use your dos prompt and do anything you want in the vm, reinstall it if it get corrupted. unlimited OS.

Like  (0 likes)

No you cant run .bat files on linux....

No you cant run .bat files on linux.

You have to write shell script instead.

If you want to learn shell scripting this is a very good starting point:
http://tldp.org/LDP/abs/html/index.html

Like  (0 likes)

Hello Hurtboss,...

Hello Hurtboss,

Try renaming the bat file to run.sh, as others have suggested.

Then open run.sh in a text editor and remove the lines:

@ECHO OFF

title jvm

echo jvm

echo Newest client running

And add this line:

#!/bin/sh

This line makes it work like a bat file does under windows.

Next change the line:

JAVA -Xmx500m EGUI

so that the word Java is all lowercase:

java -Xmx500m EGUI

The reason for this is that under Unix (which Linux is based off of) most applications have lower names.

So you should have something similar to:

#!/bin/sh
java -Xmx500m EGUI

Now, if you are using a terminal, run

chmod u+x run.sh

This makes it executable, so that you can run it. (it sets the X bit that Steve Tompkins-MacQueen mentioned.) This is unlike Windows, where anything with a .exe extension will be launched as a an executable. This goes into a bit more depth if you would like: https://help.ubuntu.com/community/FilePermissions

And then

./run.sh

to launch the program. And that should be it.

If you aren't using a terminal, right click on the run.sh and select properties. Then find where it allows you to change permissions (or if it has a button that says "launch as executable" or something similar, select that and skip the next step). In permissions, make certain that it is set to be executable.

Then double click on run.sh and it should work.

Hope that helps :)

By the way, what game is it, if I may ask?

Like  (0 likes)

[quote name="Kelly Joyner"]You cannot run the .bat shell on Linux, as it is a...

[quote name="Kelly Joyner"]You cannot run the .bat shell on Linux, as it is a script for the DOS/Windows shell; if you could run it, then the options to java would likely be wrong because of the OS.

Just a polight note Not all scrips are "java"

Like  (0 likes)

P.S this may not be the right place to put this but it is all connect to the...

P.S this may not be the right place to put this but it is all connect to the arignal question.

If you did tranlat/port it and it did something usfull there is also the question of "rights"/"access" control.

All files in Linux/Unix have 9 levels of access (Read, Write, Exaquit) for the User, Group and Others. Hence when you do a "ls" (list) in a termail next to the file there are a group of 9 letters (RWXRWXRWX) some of them displayed some not

So for a file e.g run.sh you will see one of the flowing in a list:

RWXRWXRWX run.sh

or
RWXR.XR.. run.sh

or R..XR..XR..X run.sh

or somethin simler. The meanings are as flowes

the first 3 letters are for the Owener/User
the next 3 letters are for the Group
and the finle are for Others

So if the first letter is R that means the Owner/User can Read the file.
if the second letter is W that mean the Owner/User can Write/edit/delete the file
if the 3rd letter is x that means the file can be exaquarted/run

so if the 3rd,6th and 9th letter is X then the file is exaquable by eveory one.

and so on I hope this helps

Like  (0 likes)

First sorry for the spelling I am dislex.... (if the admin can edit this...

First sorry for the spelling I am dislex.... (if the admin can edit this please feel free to do so)

.bat files are inded DOS files and can not be directley run on linux but thay can be Opened/Read/Edited iver in a termail using a basic text editor like VIM or Nano. Also in any text editor like gedit on gnome or kedit on KDE. But please rember that if you open/edit it in a wordprosser like OpenOffice then the chances are the file will be saved in a format that is difent (not plain text) from the ovignail.

Thay can be run in a emulater like DOSBOX.

It may also beposible to port/tranlate it to a shell script (.sh) file but you will have to have shell scrips programming knolige to do this by hand as that is as fare as I know the only way. (I know of no automatic tool)

Like  (0 likes)

I'll post it here , but I think it won't work , simply because this Client...

I'll post it here , but I think it won't work , simply because this Client supposedly connects to other text to run , but it won't hurt to give it a try

@ECHO OFF

title jvm

echo jvm

echo Newest client running

JAVA -Xmx500m EGUI

Like  (1 like)

You cannot run the .bat shell on Linux, as it is a script for the DOS/Windows...

You cannot run the .bat shell on Linux, as it is a script for the DOS/Windows shell; if you could run it, then the options to java would likely be wrong because of the OS.

However, run.bat is likely a simple script. If you can post it in the forums, you may find someone able to "translate" it to a bash shell script that will run on Linux. You will also, obviously, need to have Java installed, which you can download from java.sun.com

Like  (0 likes)

Sorry for the double post LOL , didn't realize it.

Sorry for the double post LOL , didn't realize it.

Like  (0 likes)
Click Here!