I'd like to reach that point where I have a development environment with the following attributes:
JMeter tests consist of JSR 233 scripts mainly
JSR 233 scripts are written in Java
I can edit the java code in IntelliJ
the project is a maven project
So far I could do everything from the list above except IntelliJ support. So, I add a JSR 233 PreProcessor script to the test using JMeter GUI, I setup the script path. When I create the .java file and start to edit in Intellij following examples IntelliJ gets crazy, since the code is not enclosed in a class {}. As a result I can't leverage on IntelliJs capabilities and great support in java.
Is there any way to configure IntelliJ to support these script files?
I double checked how the example Java code is stored in the jmx file, and it is not enclosed in a class {}.
Why not Groovy? you might ask. The reason is that, when I made a mistake in groovy script it doesn't cause build failure, it will give me a runtime error. I consider this not effective enough, however groovy is plan C.
Plan B is all java code gets into an external jar and will be included in minimal groovy script.
I would really appreciate if you could help with answers or any articles probably answers my question.
Java scripting code is actually running Beanshell language
You have BeanShell Box plugin that support your requirement in Intellij
Adds a BeanShell toolbox allowing you to write snippets of both Java and BeanShell code.
Benshell file extension is .bsh usually
Related
I know of several solutions for files that end in ".class", where you can use the ByteCode Outline plugin, or the Bytecode Visualiser plugin, or even the built-in "javap-like" viewer for classfiles.
But I would like this ability for runtime-generated code while debugging! What I am trying to achieve is to see the actual generated code from a clojure call executing. This uses ASM to generate classes on the fly.
Using the eclipse IDE, you can combine JAD(a java decompiler) with the JADClipse plugin to decompile your class files on the fly whenever the debugger attempts to open a class file that has no linked source. Without eclipse, you can use JAD as an independant executable, but it is less user friendly.
JAD will generate the java source for a class file even if it was built with a java assembler. This is possible because the java language is close enough to the functionality of the jvm. The only class files this wont work on is ones that have been run through an obfuscator to prevent decompilation
Apart from JAD, there are other tools. One's called JD (Java Decompiler). It also has an eclipse plugin and is a little better than JAD since it supports Java 5, JAD only supports Java 4 (as far as I know there hasn't been any development on JAD since 2001 or something). A tool that seems to be supporting Java 6 is DJ Java Decompiler, but I haven't tested that yet.
And I don't know if any of these tools actually support on-the-fly-generated code, on the other hand I don't really see why they should not.
I am trying to move the first steps in web scraping. I read about selenium and seems to me that it fit for what i am looking for. But i have some problems to start. I am following this tutorial selenium getting started and i am trying to compile the first example with my linux ubuntu. I have compiled in this way
javac -classpath selenium-server-standalone-2.20.0.jar Example.java
i have started selenium server with
java -jar selenium-server-standalone-2.20.0.jar
but i can't run Example. This way doesn't works
java Example
and this way too
java -classpath selenium-server-standalone-2.20.0.jar Example
I guess that the grammar is wrong, but where?
You need to include the current directory in the classpath like so:
java -cp .:selenium-server-standalone-2.20.0.jar Example
Also since you did not actually put the Example.java in org.openqa.selenium.example, you probably want to delete the package org.openqa.selenium.example in the first line of the source.
While writing code in Java a better approach would be using an IDE like Eclipse. Once you link the JARs and import them in your Java classes you can write your code quickly and efficiently.
On top of that, Eclipse has lot of plugins for testing software like Junit, TestNG's to help you create better test suites.
Not to mention a Java IDE is always helpful in debugging test code. Here is a tutorial on how to setup Eclipse with Selenium: link
Hope it helps.
I am relatively new to Eclipse and Java and have a number of tasks I would like to script when I am going to do a software release. They include running JAXB to generate source from an XSD, running javadoc to update the documentation and creating jars for distribution. What is the best way of scripting these tasks...Ant? I need the scripts to be called from our nightly build environment which is CrusieControl.net. We use both C# and Java in house but we have a single build environment on CruiseControl.net
Thanks for any help you can give.
Take a look at here :
How to execute the JAXB compiler from ANT
Javadoc task
Run ant from cc.net
I'll say go for it. We have a similar environment without java, but with tones of tools. Ant is a very useful weapon in your arsenal.
This is the third time I've installed it. I had it working on Windows, and up until a few days ago on Linux. I've done all I can do and I don't understand how to run this Java program.
The source code is a folder with a lib, src some jars and a classpath and project file.
The classpath file makes some declarations like classpathentry=src/main and path=lib, path=src.
All of these make sense. There is a folder 'main' inside 'src'.
The tiny file I'm trying to run starts off by
import de.l3s.boilerpipe.demo
I'm trying to run 'Oneliner.java'. I cannot compile it.
No matter what/where that class file is, I cannot run it. It results in a noclassdeffound.
I've run it in the main, the src, the root, the demo, the ... anywhere.
I've tried compiling it in different directories, running it with various java command line switches that were recommended. Supposedly you can have it 'search' for the file, which I've yet to experience. The sheer stubbornness of this java environment is terrifying. And massively humiliating for me.
I had the same problem with installing it. The 'Getting Started' page is poor quality.
My solution was to use a python wrapper, which you can find here: https://github.com/misja/python-boilerpipe
It takes care of all of the dependencies you'll need (however, you might be missing jpype if you're on a Mac. In that case, you'll need to install it manually from: http://jpype.sourceforge.net/).
The best way to start using the boilerpipe algorithm (and to see what it is for) is to use the demo site:
http://boilerpipe-web.appspot.com/
If you want to integrate the boilerpipe library into your applications, or even intent to modify/improve the code, you will definitely need solid Java programming skills.
As a quick-start I suggest that you install a recent version of the Eclipse IDE for Java Developers and import boilerpipe-core as a project. This avoids pretty much of the classpath configuration, and almost everything should be set up correctly for you.
The classpath file you mentioned is probably ".classpath", which is part of the Eclipse project configuration. You don't need it unless you want an Eclipse project.
Am trying to execute a complete Jython project using java eclipse 3.4.. I have configured Jython environment in my eclipse..I went through certain tutorials which described about Building a factory.. But i guess that method can be used to execute applications that are specific to a particular Jython module.. What I exactly need is::
To run the entire Jython project as a java application, by using the .class file created in the Jython project..
Not sure if this is feasible.. Suggestions please..
One Java class with an embedded PythonInterpreter is capable of kicking off an entire Jython application. May need to play around with setting the appropriate python.home and library paths, look in the PyServletInitializer and PyFilter for examples of how this is done.
Another option is use PyDev and just run a Jython script to start the application, bypassing the need for a Java application all together.