coderutil(如何配置 scala + maven + eclipse)
本文目录
- 如何配置 scala + maven + eclipse
- java.util.zip.ZipCoder.toString(Unknown Source),请问如何解决
- android中怎么在桌面创建其他应用快捷方式
如何配置 scala + maven + eclipse
最近在为eclipse配置maven和scala插件,昨天捣鼓了一天,今天终于把问题解决,其实也不是解决问题,只是重新启动新的eclipse,然后插件全部都重新装,由于之前装的插件顺序也比较混乱,只是要用什么,就装了一下的,导致eclipse崩溃。
eclipse 3.7(indigo),由于3.7版本是最新的,所以插件有可能不稳定,会导致一些意想不到的错误。
1.安装maven插件
安装插件有好几种方法,一种是在help-》Eclipse marketplace 查找m2e,另一种是在help-》Install New Software
说明:网上也有人说因为eclipse是最新版,可能你下的m2e插件不稳定,导致在Install New SoftWare的时候安装不了。查看jboss的官方博客,已经有新版的m2e插件出现在marketplace中。
一般来说,都是调用外部的settings.xml文件,这个时候就需要在window-》preferences-》maven-》user settings选择你本地的文件。
2.安装scala插件
3.安装jetty插件
maven项目比较推崇jetty服务器,在eclipse里用命令运行,平时能查看源码,但是debug的时候,会导致找不到maven 仓库里的源码(不知道大家有没有遇到过类似的问题)。
解决办法:安装jetty插件,在help-》Eclipse Marketplace 输入jetty,安装下,之后debug就能解决这个问题的。这样会有另一个问题的发生,因为在pom里配置jetty插件需要配置系统变量如下:
《systemProperties》
《systemProperty》
《name》CONFIG_DIR_PATH《/name》
《value》${basedir}/config《/value》
《/systemProperty》
《/systemProperties》
这样用命令行:mvn jetty:run 就可以读到系统变量,但是用eclipse jetty插件就会导致找不到CONFIG_DIR_PATH。
参考
问题1:创建scala project失败
Message:Unhandled event loop exception
Exception Stack Trace:
java.lang.NullPointerException
at scala.tools.eclipse.wizards.NewApplicationPage.setVisible(NewApplicationPage.scala:40)
at org.eclipse.jface.wizard.WizardDialog.updateForPage(WizardDialog.java:1260)
at org.eclipse.jface.wizard.WizardDialog.access$4(WizardDialog.java:1239)
at org.eclipse.jface.wizard.WizardDialog$8.run(WizardDialog.java:1228)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jface.wizard.WizardDialog.showPage(WizardDialog.java:1226)
at org.eclipse.jface.wizard.WizardDialog.nextPressed(WizardDialog.java:915)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:428)
at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
at org.eclipse.jface.window.Window.open(Window.java:801)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:257)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:277)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:157)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Session Date:
eclipse.buildId=M20120208-0800
java.version=1.6.0_26
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product
Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product
java.util.zip.ZipCoder.toString(Unknown Source),请问如何解决
Unknown Source,顾名思义,就是未知的源文件。因为我们最终解释运行的是class文件,所以出现这个问题的原因很简单,就是class文件中没有源文件的相关调试信息。那为什么class文件会没有调试信息呢? 答案更简单,当然是我们在用javac命令进行编译的时候没有指定调试信息呗。因为现在很多人都习惯用eclipse等一些现成的ide进行编写代码,所以很少人熟悉jdk自己的javac,java,jdb等一些命令的详细参数(jdk的一些命令和eclipse自带的一些命令可能不同)。
android中怎么在桌面创建其他应用快捷方式
Activity里添加这样的一个方法:/*** 创建快捷方式*/ public void createDeskShortCut() { Log.i(“coder“, “------createShortCut--------“); // 创建快捷方式的Intent Intent shortcutIntent = new Intent( “com.android.launcher.action.INSTALL_SHORTCUT“); // 不允许重复创建 shortcutIntent.putExtra(“duplicate“, false); // 需要现实的名称 shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); // 快捷图片 Parcelable icon = Intent.ShortcutIconResource.fromContext( getApplicationContext(), R.drawable.ic_launcher); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon); Intent intent = new Intent(getApplicationContext(), AndroidLayoutActivity.class); // 点击快捷图片,运行的程序主入口 shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, intent); // 发送广播。OK sendBroadcast(shortcutIntent); } 如果只是添加这些代码,当卸装应用程序的时候又会发现存在一个问题就是应用程序虽然卸载了,可是桌面上的快捷方式并未卸载。呵呵,其实只要设置对应启动进入的那个Intent加上这么下面的两个属性就是表明与应用绑定了。// 下面两个属性是为了当应用程序卸载时桌面上的快捷方式会删除 intent.setAction(“android.intent.action.MAIN“); intent.addCategory(“android.intent.category.LAUNCHER“); 给上完整的代码:package com.jiahui.layout; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Parcelable; import android.util.Log; public class AndroidLayoutActivity extendsActivity { /**Called when the activity is first created. */ @Override publicvoid onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_personal_info); SharedPreferencespreferences = getSharedPreferences(“first“, Context.MODE_PRIVATE); booleanisFirst = preferences.getBoolean(“isfrist“, true); if(isFirst) { createDeskShortCut(); } SharedPreferences.Editoreditor = preferences.edit(); editor.putBoolean(“isfrist“,false); editor.commit(); } /** * 创建快捷方式 */ publicvoid createDeskShortCut() { Log.i(“coder“,“------createShortCut--------“); //创建快捷方式的Intent IntentshortcutIntent = new Intent( “com.android.launcher.action.INSTALL_SHORTCUT“); //不允许重复创建 shortcutIntent.putExtra(“duplicate“,false); //需要现实的名称 shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name)); //快捷图片 Parcelableicon = Intent.ShortcutIconResource.fromContext( getApplicationContext(),R.drawable.ic_launcher); shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,icon); Intentintent = new Intent(getApplicationContext(), AndroidLayoutActivity.class); //下面两个属性是为了当应用程序卸载时桌面 上的快捷方式会删除 intent.setAction(“android.intent.action.MAIN“); intent.addCategory(“android.intent.category.LAUNCHER“); //点击快捷图片,运行的程序主入口 shortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,intent); //发送广播。OK sendBroadcast(shortcutIntent); } } 4千万别忘记在AndroidManifest.xml加上下面的这个权限: 《uses-permission android:name=“com.android.launcher.permission.INSTALL_SHORTCUT“/》
更多文章:

acquisitive的意思(inquisitive是什么意思)
2025年2月17日 15:50

reduce的名词形式(reduce relax ease区别)
2025年3月6日 02:10

vegetable怎么读音(vegetable用英语怎么读)
2025年4月9日 10:30

notice的形容词(notice都有什么词性,意思是什么)
2025年4月4日 00:10

你们用过好用的CAD制图工具吗,叫什么?如何学好机械制图与机械CAD呢
2025年2月21日 21:40

split什么意思中文翻译(we split it, fifty-flfty .怎么翻译)
2025年2月16日 01:00

短链接生成二维码(哪位有图片二维码生成器我有一些图片想把它生成二维码,我不想用在线的是草料的,电脑上用的)
2025年3月15日 11:00