Tag: linux

在Linux中设置Java的路径

我刚安装了Sun Technologies的最新版Java Development Kit。 我知道我必须为java设置PATH 我想设置路径,以便它对所有用户都有用。 我正在使用Red HAt Linux 5。

Kafka – 经纪人:集团协调员不可用

我有以下结构: zookeeper: 3.4.12 kafka: kafka_2.11-1.1.0 server1: zookeeper + kafka server2: zookeeper + kafka server3: zookeeper + kafka 使用kafka-topics shell脚本创建具有复制因子3和分区3的主题。 ./kafka-topics.sh –create –zookeeper localhost:2181 –topic test-flow –partitions 3 –replication-factor 3 并使用group localConsumers。 当领导没事的时候它工作正常。 ./kafka-topics.sh –describe –zookeeper localhost:2181 –topic test-flow Topic:test-flow PartitionCount:3 ReplicationFactor:3 Configs: Topic: test-flow Partition: 0 Leader: 3 Replicas: 3,2,1 Isr: 3,2,1 Topic: test-flow Partition: […]

使用Java中的ssh2连接到由RSA SecurID保护的Linux系统

我想创建一个从Windows系统到Linux机器的连接,它使用RSA令牌密码进行身份validation,我想运行shell命令并从Java代码获取输出。 使用putty登录Linux系统时,请执行以下步骤: 输入IP和端口并连接 在PuTTY终端输入用户名,询问“登录为:” 输入PASSCODE,我们输入RSA SecurID 我已经尝试使用Jsch包连接,但它没有连接。 我还尝试了一个jcabi-ssh的包装器jcabi-ssh ( http://ssh.jcabi.com/ )。 它们似乎都不适合我。 编辑:我使用Jsch包使用以下代码 String host = “xxx”; String user = “xxx”; String password; Scanner scanner = new Scanner (System.in); System.out.println(“Enter rsa token: “); password = scanner.nextLine(); Session session = jsch.getSession(user, host, 2222); session.setPassword(password); session.connect(); 之后我收到以下错误: com.jcraft.jsch.JSchException: UnknownHostKey: myservername. RSA key fingerprint is ba:2b:70:2f:4f:fa:f6:20:31:56:e0:e8:8b:16:46:c9 我找到了一个解决方案,有人说这条代码将StrictHostKeyChecking设置为“no”: java.util.Properties […]

Eclipse不会在Linux Mint中打开,Java也不会在不同的目录中打开

我在Linux Mint 18.2肉桂中的/opt/eclipse中使用openjdk-9安装了Eclipse(请不要告诉我切换oracle jdk)。 每当我点击Eclipse图标时,此窗口都会显示: 这是该窗口的内容: JVM terminated. Exit code=1 /usr/bin/java -Dosgi.requiredJavaVersion=1.8 -Dosgi.instance.area.default=@user.home/eclipse-workspace -XX:+UseG1GC -XX:+UseStringDeduplication –add-modules=ALL-SYSTEM -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx1024m –add-modules=ALL-SYSTEM -jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar -os linux -ws gtk -arch x86_64 -showsplash /opt/eclipse//plugins/org.eclipse.epp.package.common_4.7.1.20171005-1200/splash.bmp -launcher /opt/eclipse/eclipse -name Eclipse –launcher.library /opt/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.550.v20170928-1359/eclipse_1629.so -startup /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar –launcher.appendVmargs -exitdata 828016 -product org.eclipse.epp.package.java.product -vm /usr/bin/java -vmargs -Dosgi.requiredJavaVersion=1.8 -Dosgi.instance.area.default=@user.home/eclipse-workspace -XX:+UseG1GC -XX:+UseStringDeduplication –add-modules=ALL-SYSTEM -Dosgi.requiredJavaVersion=1.8 -Xms256m -Xmx1024m –add-modules=ALL-SYSTEM […]

在Java 8中,如何在不在我的环境中对其进行硬编码的情况下获取主机名?

我们刚刚在Amazon Linux上升级到Java 8。 我们正在使用Spring 4.3.8.RELEASE。 过去我们可以通过在应用程序上下文文件中设置bean来获取我们的机器主机名,就像这样… 但是对于Java 8,bean“hostname”现在包含字符串 localhost 在Java 8之前,它曾用于包含在命令行上运行的“hostname”值,即 [myuser@machine1 ~]$ hostname machine1.mydomain.org 如何重新配置​​我们的bean,以便它获取命令行列出的主机名? 我不想在任何地方硬编码。

Jaspersoft Studio 6.2构建路径警告

我最近安装了Jasperserver和Jaspersoft Studio来与JasperReports合作。 创建到PostgreSQL数据库的数据库连接并从该数据库构建报告后,我在Jaspersoft Studio中收到以下警告,我无法解决。 Build path specifies execution environment JavaSE-1.6. There are no JREs installed in the workspace that are strictly compatible with this environment. 我发现配置没有相关的JRE系统库,所以我尝试使用与Jaspersoft Studio一起安装的JRE系统库[JavaSE-1.6],但这并没有解决问题。 我也试过使用jre.linux.gtk.x86_64.feature_1.8.0.u65和CDC-1.0 / Foundation-1.0(jre.linux.gtk.x86_64.feature_1.8.0.u65)但没有成功。 这必须是配置问题,但我无法在Web上找到资源来解决配置问题。

在java脚本中执行shell脚本或从浏览器触发扫描器

我有一个用于扫描扫描仪(硬件)文档的shell脚本。 Shell脚本存储在每个客户端系统中。 假设客户端扫描应用程序意味着我必须运行该shell脚本并将扫描的应用程序存储在服务器中。 我正在使用Html,JavaScript和servlet。 如果我从servlet运行shell脚本,它将在服务器中执行shell脚本。 我想从客户端系统执行shell脚本。 我想如果我们使用JavaScript,我们可以做到这一点。 有没有办法做到这一点? 除了shell脚本之外,我们如何在浏览器中触发扫描程序?

从Linux EXTREME VPS读取文件时找不到文件exception

我使用java在Linux EXTREME VPS上存储图像 当我将它存储在我正在获得的服务器路径上时 /var/sentora/hostdata/campusguru/public_html/resources/images/bharath.png 使用以下代码读取路径 if(imagePath != null && imagePath.length() > 0 ) { byte fileContent[] = new byte[3000]; try (FileInputStream fin = new FileInputStream(new File(imagePath))) { //here the exception while(fin.read(fileContent) >= 0) { // Base64.encodeBase64(fileContent); } } imagePath = imagePath.replace(“\\”, “/”); byte[] imageInByte; BufferedImage originalImage = ImageIO.read(new File(imagePath)); // convert BufferedImage to byte […]

linux ulimit与java无法正常工作

我在linux ubuntu 17.10上运行代码 public class TestExec { public static void main(String[] args) { try { Process p = Runtime.getRuntime().exec(new String[]{“/bin/sh”, “-c”, “ulimit”, “-n”}); BufferedReader in = new BufferedReader( new InputStreamReader(p.getInputStream())); String line = null; while ((line = in.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } } } 此代码返回“无限” 但每当我从终端运行命令时,我得到1024。 为什么这些数字不同?

H.323,如何在没有媒体的情况下制作简单的铃声。 此脚本遵循Q.931设置但仍无效

有人可以帮我解决这个问题吗? 当我发送此请求时,我已经在wireshark中看到数据包将在1720 tcp端口发送到SJPhone。 但是SJPhone仍然不响。 我想让它响起(无论是媒体)。 我非常感谢你的支持。 我必须缺少消息协议细节来实现这一点。 请给我一些积极的指示。 仅供参考:我使用过此跟踪: http : //www.vconsole.com/usermanuals/sample_isdn_trace.pdf import java.io.*; import java.net.*; public class test { public static void main(String[] args) throws UnknownHostException, IOException { /* Step 1: simulate the Q.931 packets exchange */ byte st[]=new byte[256]; st[0]=0x08; // protocol discriminator st[1]=0x02; // length (bytes) of call reference st[2]=0x02; // call […]