Netbeans: Set up VM options for multiple dev environments? - java

Looking at LWJGL installation here.
I'm having to change the VM Options line (under Project Properties->Run) to run under Mac, even though I am continuing to develop in parallel on Windows.
That's really tedious, as I don't want to have to be changing the path each time I switch -- which will be all the time.
Any ideas on how I might get around this?

You could create two sets of configuration: In Project Properties > Run > New Configuration.
Create 2 configs (say "Win" and "Mac") with the respective VM Options.
You can then switch from one to the other with a right click on Project > Set Configuration > Win / Mac.

Related

what's the difference between eclipse.ini and run configuration settings about jvm memory?

I am facing a memory problem in an application,so I have to set up the right jvm memory arguments e.g -Xms???m or -Xmx???m.
But I found two way to setup it, first is to setup in the eclipse.ini, the other way is to setup in eclipse's run configuration---auguments setting.
But what's the difference between the two way of memory setting, what's the exactly meaning of them.
Thanks in advance.
These control different things.
The settings in eclipse.ini control the JVM that Eclipse runs in. They have no effect on programs you run from Eclipse.
Eclipse starts a separate JVM when you run your program. The Run Configuration settings control that JVM. You have a separate Run Configuration for each program so that you can set things differently for each program.

Eclipse IDE: Run configurations and switching default JVM arguments

I'm looking for some way to switch between default VM arguments. I've got a workspace with a bunch of projects and created run configurations for running JUnit tests. I'm able to switch between run configurations easily.
In order to run any test correctly, I need to pass some arguments to JVM. This is problem whenever I want to run a specific test method SHIFT+ALT+X,T. Since it creates a whole new Run Configuration, it doesn't pass any VM arguments to it.
I figured out how to set default VM arguments using Window -> Preferences -> Java -> Installed JREs -> Edit -> Default VM arguments. This, however, means that whenever I need to switch to different VM arguments, I'd have to do it manually.
What I'd need in the most optimal case is some select box visible on the toolbar, where I could switch between global run configurations from which all newly created ones would "inherit".
I'd also like to see a way to make automatically created run configurations destroy themselves as soon as I switch to a different one, because at this point, I have 36 run configurations (which I manually created) and I don't want to see a "garbage" from each test method I executed. Over the time, there might be thousands of Run Configurations in between which I'd have to search. I don't want to spent few minutes a day deleting them.
So, the recapitulation:
Is there a way to easily switch between default VM arguments?
Is it possible to keep the list of Run Configurations clear, meaning it will only contain run configurations I created?

How to optionally open last intellij project (or not) on startup?

I have just read this question:
Stop intellij opening projects on startup
Ideally, I would like to have 2 intellij icons on my desktop - one which opens the last project and one which doesn't.
In other words, I would like the flexibility of both functions.
Perhaps intellij has some command-line argument that specify which "mode" I desire on startup?
I'd rather not have to fire up an editor and edit the xml each time I start up IntelliJ.
File --> Settings --> Appearance '&' Behavior --> System Settings.
CLICK on System Settings, not a sub-tab, and uncheck the box that says "Reopen last project on startup."
As far as separate projects are concerned you could, perhaps, make a shortcut to the IML or intellij project file in it's respective directory to your desktop and use that. This way you could link as many projects as you'd like, though passing arguments to the intellij exe is also viable it may be a bit impractical. A plugin would most likely be best to automate that process, but I don't know the technicalities so take these tips with a few grains of salt.
EDIT: I also think it's worth mentioning that intellij's settings, as is the spirit of java, has pretty close to uniform and connected preferences accross platforms whether windows or linux or mac, but extending features have to be made compatable to the specific platform if it utilizes a native function (like passing parameters to an exe in windows or doing the same with an shell script in linux.)

Eclipse will not Work?

I have two different versions of eclipse that both quit working on me, I am using windows 7 home premium, the versions of eclipse that I have are Eclipse Luna 4.4 and Eclipse Juno. I have done the following things to correct the error but I am not getting a crash report or anything. In the following order I have tried:
Restarting my computer,
Deleting eclipse and reinstalling,
From command running
Eclipse.exe -clean
Eclipse.exe -clean -clearPersistedState
Eclipse.exe -debug
I have also checked my JAVA_HOME environment variable which is properly set, and the PATH environment
Variable which is also properly set. Still not sure what is going on.
:::EDIT:::
Ok I did Find a report on my windows compatibility checker saying that the application
is incompatible with windows and the repair the issue section failed to repair it.
I do know that two days ago I was working in the eclipse environment without a problem.
When I got home yesterday my machine showed that there had been new updates installed. I
didn't have any issues until yesterday. So I guess my next question is how do I find what
made the application incompatible with my machine, and if it was the updates how do I reverse
them so that I can get my IDE back, I could switch to Netbeans But I prefer to not have to do
so It just doesn't make any sense to do so if I could somehow manage to get eclipse working
again.
all give me the same result, a quick flicker of what I imagine is the Eclipse splash screen and that is it, so my question is where might I find a crash or debug report (if one is generated by eclipse) other wise does any on have any idea what may be happening.
THANKS..
Running Eclipse
After installing the Eclipse SDK in a directory, you can start the Workbench by running the Eclipse executable included with the release (you also need at least a JDK6 or JRE 6, not included with the Eclipse SDK). On Windows, the executable file is called eclipse.exe, and is located in the eclipse sub-directory of the install. If installed at c:\eclipse-SDK-4.4-win32, the executable is c:\eclipse-SDK-4.4-win32\eclipse\eclipse.exe. Note: Set-up on most other operating environments is analogous. Special instructions for Mac OS X are listed below.
Allocating enough memory and solving OutOfMemoryErrors
By default, Eclipse will allocate up to 384 megabytes of Java heap memory. This should be ample for all typical development tasks. However, depending on the JRE that you are running, the number of additional plug-ins you are using, and the number of files you will be working with, you could conceivably have to increase this amount. Eclipse allows you to pass arguments directly to the Java VM using the -vmargs command line argument, which must follow all other Eclipse specific arguments. Thus, to increase the available heap memory, you would typically use:
eclipse -vmargs -Xmx
with the value set to greater than "384M" (384 megabytes -- the default).
When using an Oracle JRE, you may also need to increase the size of the permanent generation memory. The default maximum is 64 megabytes, but more may be needed depending on your plug-in configuration and use. When the VM runs out of permanent generation memory, it may crash or hang during class loading. The maximum permanent generation size is increased using the -XX:MaxPermSize= argument:
eclipse -vmargs -XX:MaxPermSize=
This argument may not be available for all VM versions and platforms; consult your VM documentation for more details.
Note that setting memory sizes to be larger than the amount of available physical memory on your machine will cause Java to "thrash" as it copies objects back and forth to virtual memory, which will severely degrade your performance.
Selecting a workspace
When the Workbench is launched, the first thing you see is a dialog that allows you to select where the workspace will be located. The workspace is the directory where your work will be stored. If you do not specify otherwise, Eclipse creates the workspace in your user directory. This workspace directory is used as the default content area for your projects as well as for holding any required metadata. For shared or multi-workspace installs you must explicitly specify the location for your workspace using the dialog (or via the "-data" command line argument).
Specifying the Java virtual machine
Here is a typical Eclipse command line:
eclipse -vm c:\jdk7u45\jre\bin\javaw
Tip: It's generally a good idea to explicitly specify which Java VM to use when running Eclipse. This is achieved with the "-vm" command line argument as illustrated above. If you don't use "-vm", Eclipse will look on the O/S path. When you install other Java-based products, they may change your path and could result in a different Java VM being used when you next launch Eclipse.
To create a Windows shortcut to an installed Eclipse:
Navigate to eclipse.exe in Windows Explorer and use Create Shortcut on the content menu.
Select the shortcut and edit its Properties. In the Target: field append the command line arguments.
Opening this shortcut launches Eclipse. (You can drag the shortcut to the Windows Desktop if you want to keep it in easy reach.)
Mac OS X
On Mac OS X, you start Eclipse by double clicking the Eclipse application. If you need to pass arguments to Eclipse, you'll have to edit the eclipse.ini file inside the Eclipse application bundle: select the Eclipse application bundle icon while holding down the Control Key. This will present you with a popup menu. Select "Show Package Contents" in the popup menu. Locate eclipse.ini file in the Contents/MacOS sub-folder and open it with your favorite text editor to edit the command line options.
On MacOS X you can only launch a UI program more than once if you have separate copies of the program on disk. The reason for this behavior is that every UI application on Mac can open multiple documents, so typically there is no need to open a program twice. Since Eclipse cannot open more than one workspace, this means you have to make a copy of the Eclipse install if you want to open more then one workspace at the same time (bug 139319).
If you need to launch Eclipse from the command line, you can use the symbolic link "eclipse" in the top-level eclipse folder. It refers to the eclipse executable inside the application bundle and takes the same arguments as "eclipse.exe" on other platforms.
On Mac OS X 10.4 and later, you may notice a slow down when working with significant numbers of resources if you allow Spotlight to index your workspace. To prevent this, start System Preferences, select the Spotlight icon, then the Privacy tab, then click the Add button ("+") and find your workspace directory in the dialog that appears.
Shared Install
The startup speed of a shared install can be improved if proper cache information is stored in the shared install area. To achieve this, after unzipping Eclipse distribution, run Eclipse once with the "-initialize" option from an account that has a write access to the install directory.

Stanford CS106a: some java applet errors that do not allow to run the programs

Wasnt able to solve the problems in this screen.
http://s8.postimage.org/n5osf76ed/qestions.jpg
All the code worked a month ago.
What have I changed: I have a different version of eclipse (now: Eclipse IDE for Java Developers 1.5.1.20120920-0737, don't know what the previous one was).
Messed with environment variable. Since this does not effect the ot
Please help.
Try this solution mentioned in this discussion.
I just ran into this problem using standard (not Stanford) Eclipse.
By now this is probably moot for you, but I'll post my solution for
future travelers.
The launch configurations for Assignment 1 default to Applet, so the
containing Karel application isn't launched. To solve this, create
and use new Application launch configurations for each file.
If you already tried to run some of the files, delete the Applet
configs created so you can reuse the names:
Open the project properties (e.g. right click on Assignment 1 and select Properties).
Select Run/Debug Configurations.
Select and Delete each configuration.
Click OK.
May the Force be with you.
Create Application configs:
Right click on java file (e.g. CollectNewspaperKarel.java) and select Run As > Run Configurations...
Select Java Application in the left pane.
Click New Launch Configuration (the icon of a document with a +).
Type a name for the configuration and set its Main class to the associated file (e.g. CollectNewspaperKarel).
Click Apply then Run. (This should run correctly and create a useful entry in the Run History.)
Eclipse will still try to default to Applet, so you will henceforth
need to launch these configurations from the Run History (either from
the Run menu or the pull down on the run button). If you accidentally
launch as default, it will add a useless Applet configuration to the
Run History (e.g. CollectNewspaperKarel (1) ). You can delete this
from the Run Configurations dialog to keep the Run History tidy.
The eclipse used in CS106A is customized for stanford and for "karel the robot" :)
Just download and install it again and things should work just fine.

Categories

Resources