Tag: eclipse

如何使用eclipse在pdf中创建波斯语内容

我在eclipse中的PDF文件中插入UNICODE字符时遇到问题。 有一些解决方案,对我来说效率不高。 解决方案是这样的。 document.add(new Paragraph(“Unicode: \u0418”, new Font(bfComic, 12))); 我想从数据库中检索数据并将其显示给用户,我的字符是阿拉伯语脚本,有时是Farsi脚本。 你建议什么解决方案? 谢谢

不能使用Scanner类,构造函数未定义,方法未定义

当我想在我的项目eclipse中导入扫描器类时,向我展示一些错误: Exception in thread “main” java.lang.Error: Unresolved compilation problems: The constructor Scanner(InputStream) is undefined The method nextLine() is undefined for the type Scanner 这是我的代码: import java.util.Scanner; public class Scanner { public static void main(String[] args) { Scanner myScanner = new Scanner(System.in); System.out.println(myScanner.nextLine()); } }

从/ src / main / resources /读取文件

您好我正在尝试执行Web应用程序并遇到问题:我不知道如何使用保存在资源文件夹中的Java打开文本文件: String relativeWebPath =”/src/main/resources/words.txt”; //Import der des Textdoumentes String absoluteDiskPath = getServletContext().getRealPath(relativeWebPath); File f = new File(absoluteDiskPath); (文件words.txt) 正如您在图像上看到的那样,我正在尝试访问words.txt,但它无法正常工作。 有任何想法吗?

如何用java连接远程mysql数据库?

我正在尝试使用Eclipse IDE创建一个JSF应用程序。 我使用远程mySQL服务器作为我的数据库。 如何连接到此远程数据库以创建表并访问它们?

在swing中绑定combobox

我正在使用Eclipse IDE开发桌面(swing)应用程序。 我有三个combobox(国家,州和城市),我需要在选择新的国家或省时自动更新数据。 我搜索了很多信息,但我发现的所有实现都是在Ajax或NetBeans中的豆类绑定框架上完成的。 我尝试了ItemEvent的解决方案,但我在启动应用程序时遇到问题,它加载了国家/地区列表而不是其他列表。 通过选择一个国家/地区,将收取州名单,但不包括城市列表。 我的代码: jComboBoxCountries.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBoxStates.setModel(new javax.swing.DefaultComboBoxModel( statesOf(evt.getItem()).toArray() )); } }); jComboBoxStates.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { jComboBoxCities.setModel(new javax.swing.DefaultComboBoxModel( citiesOf(evt.getItem()).toArray()) ); } }); jComboBoxCountries.setModel(new javax.swing.DefaultComboBoxModel( countryList.toArray()));

如何解决通过Wi-Fi(android API)发现其他设备?

最近我按照Developer.Android.Com给出的步骤进行操作 但似乎我在那里有一些运气。 我试图发现附近可用的同伴,把他们放入arraylist但似乎没有运气。 我没有得到任何东西。 我的实际2设备实际上是Android 4.1和4.2由于Wifi Direct基于API等级14,这是Android 4.0+所以我认为我的真实设备不是问题。 我使用的概念是使用1个活动和1个BroadCast接收器。 请看看我的代码,我是错误地写了还是忘记了什么? Chat1Activity.java package com.example.androtut; import java.util.ArrayList; import others.MyBroadcastReceiver; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.IntentFilter; import android.net.wifi.p2p.WifiP2pDeviceList; import android.net.wifi.p2p.WifiP2pManager; import android.net.wifi.p2p.WifiP2pManager.Channel; import android.net.wifi.p2p.WifiP2pManager.PeerListListener; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Chat1Activity extends Activity { private final IntentFilter mintentFilter = new IntentFilter(); private […]

更改JFrame标题

这段代码编译,我只是无法在标题栏上更改名称。 import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; public class VolumeCalculator extends JFrame implements ActionListener { private JTabbedPane jtabbedPane; private JPanel options; JTextField poolLengthText, poolWidthText, poolDepthText, poolVolumeText, hotTub, hotTubLengthText, hotTubWidthText, hotTubDepthText, hotTubVolumeText, temp, results, myTitle; JTextArea labelTubStatus; public VolumeCalculator() { setSize(400, 250); […]

Java:为什么打包到jar文件中的代码会阻止外部类访问?

我的Java应用程序有一个插件系统。 我使用URL类加载器调用外部类。 当我的应用程序作为类文件运行时,以及当我的应用程序处于JARforms时,该部分运行良好。 我遇到的问题是,插件文件可以运行他们自己的独立代码,但他们创建了一个JPanel。 当我尝试将JPanel添加到主应用程序类中的JPanel时,我得到一个引用主类的空指针exception。 (com.cpcookieman.app.Main)但是,如果我运行应用程序的类文件,只有在打包时才会发生这种情况。 我怎么解决这个问题? 为什么我的代码打包到jar文件中会阻止外部类访问jar中的类? 编辑:根据要求,堆栈跟踪。 java.lang.NullPointerException at TestPlugin2.Main.(Main.java:23) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at com.cpcookieman.ph.PluginLoader$2.run(PluginLoader.java:74) at java.lang.Thread.run(Unknown Source) 编辑2:类加载代码 String pluginsPath; if (Main.os.equals(“Windows”)) { pluginsPath = “C:\\plugins\\”; } else { pluginsPath = “~/plugins/”; } File file = new […]

用另一种颜色显示System.out.println输出

我有一个很大的项目要调试,我想知道是否有我可以用来改变eclipse输出中的System.out.println方法 例如 : System.out.println(“I want this to be red”); System.out.println(“I want this to be blue”); System.out.println(“I want this to be yellow”); System.out.println(“I want this to be magenta”); 为了更好的可读性。 EDIT 与sysout我有这个 与syserr我有这个

JavaFX Maven插件:在当前项目和插件组中找不到前缀’jfx’的插件

我正在尝试在Eclipse Maven项目中为我的JavaFX应用程序创建一个可执行jar。 我正在关注这个线程: Eclipse中的Maven的JavaFx应用程序 这个turotial: https : //www.youtube.com/watch? v = wbjW8rYlook 我得到了一个 No plugin found for prefix ‘jfx’ in the current project and in the plugin groups 尝试运行目标时出错: jfx:jar 完整版错误: [INFO] Scanning for projects… [INFO] Downloading: https://repo.maven.apache.org/maven2/com/zenjava/javafx-maven-plugin/8.1.2/javafx-maven-plugin-8.1.2.pom [WARNING] Failed to retrieve plugin descriptor for com.zenjava:javafx-maven-plugin:8.1.2: Plugin com.zenjava:javafx-maven-plugin:8.1.2 or one of its dependencies could not be […]