eclipse JCDE: error in running java card project - eclipse

I have followed exact instructions from the link eclipse-jcde, and now I have all JCDE features in my eclipse (I'm using eclipse ver 4.3.1). I made a new java card project and added new applet file to it, but when I try to run the project it shows below error:
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/String
and this is my (empty!) code:
package myPackage;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISOException;
public class MyApplet extends Applet {
private MyApplet() {
}
public static void install(byte bArray[], short bOffset, byte bLength)
throws ISOException {
new MyApplet().register();
}
public void process(APDU arg0) throws ISOException {
// TODO Auto-generated method stub
}
}
what should I do?

Related

Selenium Jar Files for Eclipse

I am trying to run the below code
package JavaBasics;
enter code here
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class OpenBrowserURL {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver",
"C:\\Users\\Pooja\\Downloads\\chromedriver_win32\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.get("https://www.makemytrip.com/?ccde=us");
}
}
I am getting error java.lang.NoClassDefFoundError for get as the jar files that i downloaded 3.141.59 has get as void
How can i fix this? Is this an issue with the jar files I downloaded. Please advice

How to resolve this error on java with selenium?

//Eclipse java code:
package openbrowser;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class OpenChrome {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.setProperty("webdriver.chrome.driver", "d://chromedriver.exe");
WebDriver driver=new ChromeDriver();
}
}
eclipse error
Error occurred during initialization of boot layer
java.lang.module.FindException: Unable to derive module descriptor for C:\Users\Om Murugaa\Downloads\Testing\selenium-server-standalone-3.141.59.jar
Caused by: java.lang.module.InvalidModuleDescriptorException: Provider class org.eclipse.jetty.http.Http1FieldPreEncoder not in module
Adding maven into eclipse resolved this error.

Unable to open chromedriver in eclipse

I'm facing errors while trying to execute a simple code to launch a chrome browser and open google.com but not able to launch the browser. Attached is the error message.
This is the code -
package gmailpkg;
import org.openqa.selenium.*;
import org.openqa.selenium.chrome.ChromeDriver;
public class login {
public static String driverPath = "X:/JARs-Setup/chromedriver_win32/";
public static WebDriver driver;
public static void main(String []args) throws InterruptedException {
System.out.println("launching chrome browser");
System.setProperty("webdriver.chrome.driver", driverPath+"chromedriver.exe");
driver = new ChromeDriver();
driver.get("http://google.com");
Thread.sleep(2000);
//driver.manage().window().maximize();
Thread.sleep(2000);
driver.findElement(By.xpath( "//*[#href='https://mail.google.com/mail/?tab=wm']")).click();
}
}

Is there a way to tell eclipse to organize import A, import A.X and import B in that order?

Please see the sample program below (just to illustrate the problem and the code as such does nothing):
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
public class Test {
public static void main(String[] args) {
Map map;
Properties props;
Entry entry = new Entry<String, String>() {
#Override
public String setValue(String value) {
// TODO Auto-generated method stub
return null;
}
#Override
public String getValue() {
// TODO Auto-generated method stub
return null;
}
#Override
public String getKey() {
// TODO Auto-generated method stub
return null;
}
};
}
}
Eclipse organizes them as above and not as follows:
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
thanks.
everithing you can do about the "organize import" function is defined in the following preferences page:
preferences -> java -> code style -> organize imports
I realized that it's a bug in solaris eclipse v 3.5.0. This doesn't seem to happen on eclipse helios on windows.

Starting Selenium with custom Firefox profile from Eclipse

I'm running Selenium tests from within Eclipse, but I can't load a custom Firefox profile.
Most sources suggest I need to launch the Selenium Server like this:
java -jar selenium-server.jar -firefoxProfileTemplate </path/to/template/>
But when launching my test from within Eclipse it doesn't use that - the tests will run if the Selenium Server isn't running.
This thread suggests that I can set the profile in the DefaultSelenium constructor:
Selenium RC - disabling browser cookie
But the code generated for me by Selenium IDE (Firefox plugin) doesn't use that constructor:
package com.example.tests;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class Example extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.example.com/", "*firefox");
}
public void testExample() throws Exception {
selenium.open("/");
selenium.click("//body");
}
}
Where should I set the DefaultSelenium configuration options? Or is there some other method I can use to load my custom Firefox template?
Thanks!
Stu
I made a SeleniumTestCase that starts/stops the server before/after each test class and starts/stops the Selenium instance before/after each test:
public class SeleniumTestCase {
protected static Selenium selenium;
protected static AppNavUtils appNavUtils;
#BeforeClass
public static void setUpBeforeClass() throws Exception {
SeleniumServerControl.getInstance().startSeleniumServer();
}
#AfterClass
public static void tearDownAfterClass() throws Exception {
SeleniumServerControl.getInstance().stopSeleniumServer();
}
#Before
public void setUp() throws Exception {
// Replace "*chrome" with "*firefox" for Selenium > 1.0
selenium = new DefaultSelenium("localhost", 5444, "*chrome", "http://localhost:8080/");
selenium.start();
appNavUtils = new AppNavUtils(selenium);
}
#After
public void tearDown() throws Exception {
selenium.stop();
}
}
The SeleniumServerControl starts and stops the server:
public class SeleniumServerControl {
private static final SeleniumServerControl instance = new SeleniumServerControl();
public static SeleniumServerControl getInstance()
{
return instance;
}
private SeleniumServer server = null;
protected SeleniumServerControl(){}
public void startSeleniumServer() {
if (server == null) {
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setPort(5444);
//rcc.setFirefoxProfileTemplate(newFirefoxProfileTemplate)
server = new SeleniumServer(rcc);
}
server.start();
}
public void stopSeleniumServer()
{
if (server != null) {
server.stop();
server = null;
}
}
}
the version of code you have above assumes that you are running your tests against localhost on port 4444 thats why it is has 2 parameters in the setup.
To set up eclipse to run it you will need to update the run configuration. That is under
Run > Run Configurations
Have a look for the item that has selenium in it and add the config above so that when it runs it will pick it up and run.
I personally just fire up the server when I start working by running a batch file and kill it at the end of the day.