| career | drupal | java | mac | mysql | perl | scala | uml | unix  

JMeter example source code file (eclipse.readme)

This example JMeter source code file (eclipse.readme) is included in the "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - JMeter tags/keywords

ant, ant, build, eclipse, eclipse, java, jdk, jmeter, jmeter, now, rmi, the, the, then

The JMeter eclipse.readme source code

Eclipse settings
The following files should be excluded from build output:
See Preferences/Java/Building/Output Folder/Filtered Resources

[This has been tested with Eclipse 3.2. It may not work with other versions.]

The file eclipse.classpath is intended as a starter .classpath file 
for building JMeter using Eclipse version 3.  

Note that Eclipse does not handle RMI compilations, 
nor is it easy to use for creating jar files.

However, it is easy to use Eclipse to run Ant.

The following targets may prove useful:

  compile-rmi - compiles the RMI files that Eclipse ignores
  package-only - creates the jars
  package - compiles everything and then packages it
  run_gui - compiles, packages, and then start the JMeter GUI from the jars

Invoking Ant targets inside Eclipse
You can use the "Run As --> Ant Build" and select target, or you can use
the "Windows->Show View->Ant View". Then select the "build.xml" file and
drag and drop to the "Ant View".
Now you can invoke targets by clicking on them.
Note that if you invoke for example the "compile" target, and get error
messages about 
Unable to find a javac compiler; is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
it just means that your Eclipse project is set up with JRE libraries instead of JDK libraries.
The suggested fix is to add a JDK in "Window->Preferences->Java->Installed JREs".
Then do a "Project->Properties" and select "Java Build Path" in the left pane, and then
select the "Libraries" tab in the right pane. Scroll to the bottom, select the "JRE System Library",
and click "Remove". Then click "Add library..." , select "JRE System Library", and then select
the JDK. Now it should work when you invoke the "compile" target.

Finishing the build using Ant

Find the build.xml file in the project, 
right click on it, and click "Run As --> Ant Build".

Make sure you select the "package" target.

This will compile any remaining classes (e.g. the RMI ones),
and then create all the jars.

Now refresh the project (you should add this to the Ant build properties)

Launching from Eclipse

You can use the Ant target run_gui to run the JMeter GUI, or you can follow the instructions
below to add a Java Application launch, which will for example, allow you to use the debugger to
run JMeter.

These instructions assume you have configured Eclipse to use the classpath
as suggested in eclipse.classpath, and have run "ant package" to compile
the RMI classes and build the jars.

Create a new Java Application launch configuration.

On the Main tab, enter the following as the main class:

On the Arguments tab, in the Working Directory area, pick the radio
button next to "Other" and enter the following in the text box:

 where "jmeterproject" is the name of the JMeter project.
 [It would be nicer to use ${project_loc}/bin 
 but unfortunately the Eclipse Debug view does not seem to preserve any of the project variables]

Other JMeter examples (source code examples)

Here is a short list of links related to this JMeter eclipse.readme source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.