Alice Community  

Go Back   Alice Community > Announcements > Community News and Announcements

Reply
 
Thread Tools Display Modes
Old
arevira
Guest
 
Status:
Posts: n/a
Lightbulb 06-20-2009, 10:16 AM

Quote:
Originally Posted by lanceA View Post
I have an icon on my Desktop which, when clicked, runs an Alice 3.0 program without requiring Alice
There are a couple of ways of doing this. The one I always use is with Launch4j. This is a free software that creates an executable (.exe, in Windows) wrapper for your jar files. It works for Windows (Linux, Macs, etc). It is highly customizable, and it even allows you to create a splash screen to be displayed when your program is executed.

Cheers
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 06-20-2009, 12:03 PM

Quote:
Originally Posted by lanceA View Post
This continues to be interesting!

I have an icon on my Desktop which, when clicked, runs an Alice 3.0 program without requiring Alice. And yes, it takes some learning (I had to waste 3 hours today learning how to do it! ) but it is doable.
Yes, it really is doable - I finally got that working a few minutes ago. And it took me well over 3 hours - I probably wasted that much time before I finally figured out (or remembered?) that you had to reboot for a CLASSPATH change to beome efective.

The approach I came up with is certainly not ready for prime time yet - as much due to my problems with Alice 3 Beta and NetBeans as anything else. (Why can't programs do what you want them to do instead of what you actually tell them to? ) But I am really impressed by the potential that is there.
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 06-20-2009, 02:32 PM

Quote:
Originally Posted by arevira View Post
There are a couple of ways of doing this. The one I always use is with Launch4j. This is a free software that creates an executable (.exe, in Windows) wrapper for your jar files. It works for Windows (Linux, Macs, etc). It is highly customizable, and it even allows you to create a splash screen to be displayed when your program is executed.

Cheers
Thanks for the information but I do not believe Launch4j is the answer - I would love to be proven wrong!!

Several Java switches need to be set when running the program. It looks like the package relies on JNI to load a C++ library. (possibly the .dll's).



Anyway when I run my programs I have to use:
  • -ea to enable assertions.
  • -Xmx1024m which gives Java more memory to play with. In this case, 1 gig. It doesn't mean Java will use it, only that it is allowed to use it if necessary.
  • -DJava.library.path which points to the .dll libraries for the package
I'm not sure Launch4j will allow me to do all that but thank you for sharing - we all need help in these uncharted waters. It would be nice if it did. If you know how please share with me.

P.S. I got this information when I simply typed:
java -jar AliceProjectWizardProject.jar from the DOS prompt
...and also by reading the README.txt file in the .dist folder.



Good luck,

Last edited by lanceA; 06-20-2009 at 02:37 PM. Reason: Normal bloody typos
   
Reply With Quote
Running NetBeans Alice project from command line
Old
arevira
Guest
 
Status:
Posts: n/a
Default Running NetBeans Alice project from command line - 06-20-2009, 03:39 PM

My problem was that I was invoking a very old version of java (1.4.2) when using the command line. Once I deleted that and pointed my env vars to the latest jdk release I got it to work.

You are right, LanceA. I also took the information about the needed switches from the error messages when running the project for the command line.

However, for those who have not done this yet, the path given in these error messages is not the right one. That path is for an earlier Beta release, 3.beta.0000 (the directory structure is also different).

The path given there is:
/Program Files/Alice/3.beta.0000/tools/jogl/lib/windows-i586

But, for version 3.0.0.0.55 (the one currently available), this path should be:
<drive>\Program Files\Alice3Beta\application\windows-i586
This points to the java native interface DLL file.

The path to the Java OpenGL DLLs is
<drive>\Program Files\Alice3Beta\ext\jogl\lib\windows-i586

Both of this paths have to be passed to java for executing your project.

Assuming you installed Alice3.0 in the default folder, and on the C: drive, the following command will run your AliceProjectWizardProject.jar (The file generated when you build an Alice project in NetBeans):

Code:
java -ea -Xmx1024m -Djava.library.path="C:\Program Files\Alice3Beta\application\windows-i586;C:\Program Files\Alice3Beta\ext\jogl\lib\windows-i586" -jar "AliceProjectWizardProject.jar"
I run this command inside the folder
C:\Documents and Settings\<yourusername>\My Documents\NetBeansProjects\<yourAliceProject>\dist
This folder is created automatically by NetBeans when you build your project.

I would recommend people to make a little BAT file for running your projects from the command line. Since all built project files are named AliceProjectWizardProject.jar, you could just copy and paste this BAT file in the dist folder of each Alice NetBeans Project your create.

This is a way you can create that BAT file:

1- Start notepad.exe (On XP: START > All Programs >Accessories > Notepad)

2- Paste the following in the editing area:
Code:
java -ea -Xmx1024m -Djava.library.path="C:\Program Files\Alice3Beta\application\windows-i586;C:\Program Files\Alice3Beta\ext\jogl\lib\windows-i586" -jar "AliceProjectWizardProject.jar"
Make sure this forms a single line --widen the Notepad window and scroll sideways if necessary.

3-Save your file as run.bat inside the dist folder of your project.
Make sure "Save as type" option is set to "All Files" (otherwise notepad may insists in adding .TXT after run.bat

Now, whenever you want to run your NetBeans Alice Project, navigate to the dist folder of the project and double-click on the run.bat file.

Cheers

Last edited by arevira; 06-20-2009 at 03:54 PM.
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 06-20-2009, 09:48 PM

As I mentioned in an earlier post, that is why I use a batch file and not Launch4j.

Thank you for your input.
   
Reply With Quote
Create executable with Launch4j
Old
arevira
Guest
 
Status:
Posts: n/a
Default Create executable with Launch4j - 06-20-2009, 11:45 PM

I uploaded a tutorial for creating an EXE wrapper for your Alice3.0 NetBeans project using the free software Launch4j.

I uploaded the file here in the "Questions and Comments" section of the forum because I could not upload attachments in this thread.

The tutorial only outlines the minimum number of steps to generate an EXE wrapper for your project. Like I mentioned in an earlier post, Launch4j is highly customizable and you can even add a splash screen.

Enjoy

Last edited by arevira; 06-20-2009 at 11:50 PM.
   
Reply With Quote
Making it portable
Old
arevira
Guest
 
Status:
Posts: n/a
Post Making it portable - 06-21-2009, 12:18 AM

Neither lanceA's batch file nor my idea of using Launch4j *as they stand now* make your project distributable to others without Alice3.0 being installed in their computers.

In order to do this, you need the following:
  1. Inside the dist folder of your built project, create a DLL folder
  2. Copy the .dll files from the following two folders:
    C:\Program Files\Alice3Beta\application\windows-i586
    C:\Program Files\Alice3Beta\ext\jogl\lib\windows-i586
    to the DLL folder you created in the previous step.
  3. Create an EXE wrapper using Launch4j (see here). Notice that, for the values passed to the VM, use java.library.path="DLL"
  4. Compress the dist folder

You could then send the compressed folder to someone, who would then just unzip it and double-click on the EXE file.

BEFORE YOU ATTEMP THIS: I have not checked the licensing terms the DLL mentioned above are subjected to. What I am suggesting here is technically possible, but it may be *illegal*!! Please, check the licenses to make sure this is allowed. DO NOT DISTRIBUTE THE DLLs UNLESS YOU ARE 100% SURE THIS IS ALLOWED. I posted this information in the interest of advancing knowledge in this area only.

*** IMPORTANT ***
There is something I missed in my first post.

Last edited by arevira; 07-01-2009 at 12:19 PM. Reason: Information about the Alice Gallery was missing
   
Reply With Quote
Confused as always
Old
DrJim
Guest
 
Status:
Posts: n/a
Default Confused as always - 06-21-2009, 12:01 PM

Well I'm as confused as usual - but at least at a higher level about things that seem potentially really useful. Thanks for all your postings.

A couple of fairly basic questions:

1. Since all built project files are named "AliceProjectWizardProject.jar," does it hurt to rename them?

2. If so, is it possible to just duplicate the supporting files once, or do you have to do that for all projects?

3. If you can get by with doing it only once, can you then run a .jar file imbeded in a web page?

4. Do you need the full JDK to run the projects or is the JRE enough?

In case it's not obvious, what the underlying question really is is if one can create the equivalent of an "export to web page" for a project using the build capabilities of NetBeans. If so, the legal question becomes significant - hopefully Gabe or someone at CMU can give an answer on that.

I'll try to get the answers to these questions myself, but at the speed I work with this stuff, that may take a while.
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Smile 06-21-2009, 07:30 PM

On computers running M$ Windows XP or later, the maximum length
of the string that you can use at the command prompt is 8191 characters.
On computers running M$ Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters. I realize that you were talking about a batch (.bat) file so kindly continue to read...

I trust you are aware that in XP you can give a batch file the extension .cmd? Guess what the characters-per-line limit on a .cmd file is?

I personally take offense with your statement regarding "arguing" - I view what arevira and I have been discussing as exchanging ideas and information. If you have some positive input concerning working with Alice 3.0(beta) and Java that we all could benefit from, please share it. We openly welcome it. Let's all work together on this new release to explore its capabilities.

In the mean time I wish you success in your quest to advance an obsolete product - "...advance Alice 2.0 to a higher level than it was intended." I was of the impression it was intended to be a teaching tool.

I apoligize for not being as computer literate as you claim to be.


Last edited by lanceA; 06-21-2009 at 07:42 PM. Reason: Normal typos
   
Reply With Quote
Old
lanceA
Guest
 
Status:
Posts: n/a
Default 06-21-2009, 07:46 PM

Quote:
Originally Posted by autoteck View Post
You boys and girls get done with your stuff--I will have advanced Alice 2.0 to a higher level than it was intended.

You guys talk nonsense and the results will show when its judgment day either for you or me. If I was to put my money on someone it would go to the person who knows computers. Knowing the "path statement" in either a batch file or in the command statement in Windows "could be the ticket". I've played with the batch file in Alice 3.0--changed the path--try it some time. Also ask yourselves this question--is there a "shell statement allowed". But it don't matter does it Jim. If you look at the command line in the batch file you will see its all on the same line. Somewhere some one wrote that only 256 characters are allowed.

I really feel sorry for you guys--you'll never get stuff done arguing over this. It makes me laugh how confusing you all can be at times..

But some day you might ask my opinion and you might get stuff done today--not next week..
On computers running M$ Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running M$ Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters. I realize that you were talking about a batch (.bat) file so kindly continue to read...

How do you expain Alice.bat, which is the batch file used to open Alice 3.0 (beta)??? When I open it in Notepad it is 7 lines long!!! How computer literate are you? (256 characters??) We are NOT talking about DOS's path statement. When working with Java my friend think about Java's classpath statement, there is a difference. Open Alice.bat and go to the characther postion 252 and there you should see the Environment Variable: - ClassPath. The batch file is more than 700 characters in size.

I personally take offense with your statement regarding "arguing" - I view what arevira and I have been discussing as exchanging ideas and information. You are not aware of any private conversations arevira and I have had concerning this matter.

If you have some positive input concerning working with Alice 3.0(beta) and Java that we all could benefit from, please share it. We openly welcome it. Let's all work together on this new release to explore its capabilities.

In the mean time I wish you success in your quest to advance an obsolete product - "...I will have advanced Alice 2.0 to a higher level than it was intended." I was of the impression it was intended to be a teaching tool.

I apoligize for not being as computer literate as you claim to be.


Last edited by lanceA; 06-21-2009 at 09:14 PM.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2020, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.