Tag: eclipse

Java Runtime.getRuntime()。exec丢失/更改一些参数

( -Dexec.mainClass=maven.MainClass成为maven.MainClass 。) 在Java中使用maven执行Java类时( Eclipse插件 -Dexec.mainClass=maven.MainClass ) -Dexec.mainClass=maven.MainClass变为maven.MainClass package maven; public class MainClass { public static void main(String[] args) { System.out.println(“app is running!”); } } 来自Eclipse使用 Process p = DebugPlugin.exec(cmds, workingPath, envp); RuntimeProcess process = (RuntimeProcess)DebugPlugin.newProcess(launch, p, MavenConstants.PROCESS_MESSAGE); 那个p= Runtime.getRuntime().exec(cmdLine, envp); 只是调用Java p= Runtime.getRuntime().exec(cmdLine, envp); 连接的字符串数组看起来像下面的字符串,不知何故失去-Dexec.mainClass= part。 D:\Code\springsource\3.0\apache-maven-3.0.3\bin\mvn.bat compile exec:java -Dexec.mainClass=maven.MainClass 产量 [INFO] Scanning for […]

在eclipse中运行Java app时如何避免glob扩展

我遇到了Eclipse运行配置的特殊行为,它似乎只是一个Windows问题。 假设我有一个打印出命令行参数的Java应用程序,如下所示: public class WildCard { public static void main(String[] args) { for (String arg: args) { System.out.println(arg); } } } 如果我使用可以由shell扩展的外卡提供参数,shell将展开它并将其提供给Java程序。 这并不奇怪。 所以,如果我在命令提示符下做 java WildCard test/* 该程序将打印 test/foo.txt test/bar.txt 其中foo.txt和bar.txt是目录“test”中的文件。 如果我用引号括起通配符参数,可以防止Shell扩展; * nix上的单引号,以及Windows上的双引号。 因此对于Windows,如果我在命令提示符下执行以下操作: java WildCard “test/*” 该程序现在将打印 test/* (没有扩张)。 但是,我发现Eclipse运行启动程序中的引用似乎没有效果,并且参数仍在扩展。 如果我放 “test/*” 在Eclipse运行启动程序的程序参数部分,并运行上面的类,我仍然得到 test/foo.txt test/bar.txt 换句话说,当程序实际运行时,双引号似乎丢失了。 这似乎只发生在Windows上。 有没有办法在Windows上使用Eclipse运行启动程序阻止glob扩展?

将事件添加到此日历

我正在开发一个程序。 它有一个日历。 当用户按下事件显示的日期时。 然后我希望应用程序在事件即将发生时向用户发送通知。 我正在使用的日历来自此站点日历示例 package com.examples; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.List; import java.util.Locale; import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.text.format.DateFormat; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.View.OnClickListener; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; […]

使用Google Web Toolkit启动Maven项目的Eclipse配置

我正在与web创建者一起开始一个GWT项目如下: C:\>webAppCreator -noant -maven -overwrite -out MavenTest com.raphiki.MavenTest 它使用GWT Hello world项目生成Maven项目的结构,我在Eclipse中将此项目导入为具有现有源的Maven项目 。 然后我在我的项目中启用了Google Web Toolkit,我需要提供一个WAR路径。 我尝试使用包含入口点的/src/main/webapp ,但是当我启动应用程序时,我在Hello world的类包上得到了一个ClassNotFoundException 。 请参阅下图,这是WebAppCreator构建的结构: 我错过了任何配置吗?

Eclipse插件项目与其他项目依赖项

我有一个Eclipse插件项目,它依赖于我在Eclipse工作区中的其他项目。 在“Java Build Path” – >“Projects”选项卡下添加项目依赖项,并在“Order and Export”中选择项目后,我得到一个java.lang.NoClassDefFoundError。 我假设其他项目没有正确地包含在插件中。 有谁知道如何解决这一问题? 谢谢,詹姆斯

使用Eclipse构建Android的原生Opencv,给出了“未定义的对`cvCreateFileCapture’的引用”

我正在开发一个带有原生部分的应用程序,它使用嵌入式OpenCV从video文件中提取帧。 到目前为止,我收到了这个错误: …/jni/ocv.c:12: undefined reference to `cvCreateFileCapture’ 我的Android.mk: LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := ocv LOCAL_SRC_FILES := ocv.c include $(BUILD_SHARED_LIBRARY) Application.mk: APP_STL := gnustl_static APP_CPPFLAGS := -frtti -fexceptions APP_ABI := armeabi ocv.c: #include #include #include #include #include #include jstring Java_com_ice_salvador_MainActivity_invokeNativeFunction(JNIEnv* env, jobject javaThis) { IplImage* currFrame = 0; CvCapture* cap = 0; cap […]

Mainactivity.java中的错误

我有以下代码,我找不到摆脱这些错误的方法: 类型View中的方法setOnClickListener(View.OnClickListener)不适用于参数(MainActivity) 这适用于包含以下内容的第17,18,19,20,21,22,23,24,25行: findViewById(R.id.imageButton9).setOnClickListener(this); 在第31行(创建新类的行)中,我得到: 嵌套类型MainActivity无法隐藏封闭类型 这是我正在使用的代码: package com.example.rome; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.EditText; import android.widget.Button; import android.view.View; import android.widget.Toast; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.imageButton1).setOnClickListener(this); findViewById(R.id.imageButton2).setOnClickListener(this); findViewById(R.id.imageButton3).setOnClickListener(this); findViewById(R.id.imageButton4).setOnClickListener(this); findViewById(R.id.imageButton5).setOnClickListener(this); findViewById(R.id.imageButton6).setOnClickListener(this); findViewById(R.id.imageButton7).setOnClickListener(this); findViewById(R.id.imageButton8).setOnClickListener(this); findViewById(R.id.imageButton9).setOnClickListener(this); } class MainActivity extends Activity implements View.OnClickListener { @Override […]

如何将JDBC驱动程序链接到缺少WEB-INF文件夹的EJB项目

我在Neon Eclipse中有Enterprise Appilcation Solution,它包含EJB和Servlet项目并部署到Wildfly 10服务器。 Servlet为访问DB调用EJB。 如果我把JDBC驱动程序放在Servlet项目的WEB-INF文件夹中,一切进展顺利,但如果我将代码移到EJB并将驱动程序作为外部JAR链接(见截图),我会收到错误: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from [Module “deployment.NeoflexBank.ear.Neoflex.jar:main” from Service Module Loader] 这是我用来访问DB的代码: public String test() { String output = “”; try { Class.forName(“com.mysql.jdbc.Driver”).newInstance(); } catch (Exception e) { e.printStackTrace(); } String url=”jdbc:mysql://localhost:3306/neoflex”; String username=”root”; String password=””; String query=”select * from clients”; Connection conn; try { conn = (Connection) DriverManager.getConnection(url, username, […]

更新到Windows 8.1后,BIRT报告未在eclipse中运行

最近更新到Windows 8.1后,我无法在eclipse中运行birt报告。 Eclipse布局视图工作正常但是当我运行报告时没有任何反应。 以下是我调试报告时的信息。 请提出解决此问题的方法 Oct 19, 2013 5:09:02 AM org.eclipse.birt.report.debug.internal.core.vm.ReportVMServer start INFO: [Server] client accepted Oct 19, 2013 5:09:02 AM org.eclipse.birt.report.debug.internal.core.vm.ReportVMServer$1 run INFO: [Server] enter request dispatching Oct 19, 2013 5:09:02 AM org.eclipse.birt.report.debug.internal.core.launcher.ReportLauncher configEngine INFO: User class path received: Oct 19, 2013 5:09:03 AM org.eclipse.birt.report.engine.api.impl.EngineTask handleFatalExceptions SEVERE: An error happened while running the report. […]

执行mapreduce程序时ClassNotFoundException

我试图在eclipse中执行word count程序。 但在执行程序时,我收到以下错误 log4j:ERROR Could not instantiate class [org.apache.hadoop.log.metrics.EventCounter]. java.lang.ClassNotFoundException: org.apache.hadoop.log.metrics.EventCounter at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:190) at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198) at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327) at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124) at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:785) at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768) at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514) at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580) at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526) at org.apache.log4j.LogManager.(LogManager.java:127) at org.apache.log4j.Logger.getLogger(Logger.java:104) at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:289) […]