导航:首页 > 专利知识 > java设置软件使用期限

java设置软件使用期限

发布时间:2021-05-07 01:49:57

❶ 你好,我想问一下怎么用Java代码限制软件使用期限,能给详细代码么

获取系统的当前时间,然后减去注册时间 如果超过了你设定的期限时间就是过期了

❷ 怎样给文件夹设置使用期限,有什么软件吗

只有加密,
当然,有直接权限整个磁盘的,
改文件夹权限的没见过

❸ JAVA编写的软件,求人修改一下使用时间期限!

做的不好,请楼主和各位多提意见!!

工具: eclipse

文件名: Editor.java

代码:

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.StringTokenizer;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.Timer;

public class Editor extends JFrame {

private JPanel jContentPane = null;
private JMenuBar jMenuBar = null;
private JMenu jMenu = null;
private JMenuItem jMenuItem = null;
private JMenuItem jMenuItem1 = null;
private JMenu jMenu1 = null;
private JMenuItem jMenuItem2 = null;
private JMenuItem jMenuItem3 = null;
private JTextArea jTextArea = null;
private JScrollPane jScrollPane = null;
private File openFile=null;
/**
* This is the default constructor
*/
public Editor() {
super();
initialize();
}

/**
* This method initializes this
*
* @ void
*/
private void initialize() {
this.setSize(300, 200);
this.setJMenuBar(getJMenuBar());
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}

/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
}
return jContentPane;
}

/**
* This method initializes jJMenuBar
*
* @return javax.swing.JMenuBar
*/
public JMenuBar getJMenuBar() {
if (jMenuBar == null) {
jMenuBar = new JMenuBar();
jMenuBar.add(getJMenu());
jMenuBar.add(getJMenu1());
}
return jMenuBar;
}

/**
* This method initializes jMenu
*
* @return javax.swing.JMenu
*/
private JMenu getJMenu() {
if (jMenu == null) {
jMenu = new JMenu();
jMenu.setText("file");
jMenu.setBounds(new java.awt.Rectangle(0,0,35,35));
jMenu.add(getJMenuItem());
jMenu.add(getJMenuItem1());
}
return jMenu;
}

/**
* This method initializes jMenuItem
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem() {
if (jMenuItem == null) {
jMenuItem = new JMenuItem();
jMenuItem.setText("open");
jMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
openFile=new File(JOptionPane.showInputDialog(null,"请输入有效的文件路径","文件选择",JOptionPane.INFORMATION_MESSAGE));
FileInputStream fileIS = null;
BufferedInputStream filePS=null;
byte[] fileCode;
if(openFile.isFile()){
try {
fileIS=new FileInputStream(openFile);
filePS=new BufferedInputStream(fileIS);
fileCode = new byte[fileIS.available()];
filePS.read(fileCode);
jTextArea.setText(new String(fileCode));
filePS.close();
fileIS.close();
jMenuItem1.setEnabled(true);
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
} else{
JOptionPane.showMessageDialog(null,"打开文件路径错误","错误",JOptionPane.ERROR_MESSAGE);
}

}
});
}
return jMenuItem;
}

/**
* This method initializes jMenuItem1
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem1() {
if (jMenuItem1 == null) {
jMenuItem1 = new JMenuItem();
jMenuItem1.setText("save");
jMenuItem1.setEnabled(false);
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
PrintStream filePS = null;
File saveFile=null;
String fileName = JOptionPane.showInputDialog("输入保存文件的路径(默认为原路径)");
if(fileName.equals("") || fileName==null)saveFile = openFile;
else saveFile = new File(fileName);
if(saveFile.isFile()){
try {
filePS=new PrintStream(new FileOutputStream(openFile));
filePS.print(jTextArea.getText());
filePS.close();
} catch (FileNotFoundException e1) {
e1.printStackTrace();
} finally{
filePS.close();
}
} else {
JOptionPane.showMessageDialog(null,"保存文件路径错误","错误",JOptionPane.ERROR_MESSAGE);
}
}
});
}
return jMenuItem1;
}

/**
* This method initializes jMenu1
*
* @return javax.swing.JMenu
*/
private JMenu getJMenu1() {
if (jMenu1 == null) {
jMenu1 = new JMenu();
jMenu1.setText("util");
jMenu1.add(getJMenuItem2());
jMenu1.add(getJMenuItem3());
}
return jMenu1;
}

/**
* This method initializes jMenuItem2
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem2() {
if (jMenuItem2 == null) {
jMenuItem2 = new JMenuItem();
jMenuItem2.setText("count");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
JOptionPane.showMessageDialog(null,"当前文件的字符数:"+jTextArea.getText().length());
}
});
}
return jMenuItem2;
}

/**
* This method initializes jMenuItem3
*
* @return javax.swing.JMenuItem
*/
private JMenuItem getJMenuItem3() {
if (jMenuItem3 == null) {
jMenuItem3 = new JMenuItem();
jMenuItem3.setText("reverse");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
final StringTokenizer textTokenizer = new StringTokenizer(jTextArea.getText(),"\n");
final StringBuffer textBuffer = new StringBuffer(jTextArea.getText());

Timer replaceTimer = new Timer(100, new ActionListener() {
StringBuffer replaceBuffer = null;
int start = 0;
int end = 0;
public void actionPerformed(ActionEvent e) {
if(textTokenizer.hasMoreTokens()){
replaceBuffer = new StringBuffer(textTokenizer.nextToken());
end = textBuffer.indexOf("\n",end+1);
if(end<0) end = textBuffer.length();
start = end - replaceBuffer.length();
textBuffer.replace(start,end,replaceBuffer.reverse().toString());
jTextArea.setText(textBuffer.toString());
}
}
});
replaceTimer.start();
}
});
}
return jMenuItem3;
}

/**
* This method initializes jTextArea
*
* @return javax.swing.JTextArea
*/
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
}
return jTextArea;
}

/**
* This method initializes jScrollPane
*
* @return javax.swing.JScrollPane
*/
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
jScrollPane.setViewportView(getJTextArea());
}
return jScrollPane;
}
public static void main(String args[]){
Editor editor = new Editor();
editor.setVisible(true);
}
}

说实话自己觉得做的并不好,不过事件都有了!

❹ 如何给javaweb程序添加使用期限制程序

下一个过滤器,设定一个过期时间就好了,到期filter直接返回不进入action

❺ java如何设置软件试用期

java操作注册表,写入加密数据标记,用于计算试用期

❻ java web 开发如何控制使用期限及绑定服务器mac

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.InetAddress;
import java.net.NetworkInterface;

/**
* 与系统相关的一些常用工具方法.
*
* @author lvbogun
* @version 1.0.0
*/
public class SystemTool {

/**
* 获取当前操作系统名称. return 操作系统名称 例如:windows xp,linux 等.
*/
public static String getOSName() {
return System.getProperty("os.name").toLowerCase();
}

/**
* 获取unix网卡的mac地址. 非windows的系统默认调用本方法获取.
* 如果有特殊系统请继续扩充新的取mac地址方法.
*
* @return mac地址
*/
public static String getUnixMACAddress() {
String mac = null;
BufferedReader bufferedReader = null;
Process process = null;
try {
// linux下的命令,一般取eth0作为本地主网卡
process = Runtime.getRuntime().exec("ifconfig eth0");
// 显示信息中包含有mac地址信息
bufferedReader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String line = null;
int index = -1;
while ((line = bufferedReader.readLine()) != null) {
// 寻找标示字符串[hwaddr]
index = line.toLowerCase().indexOf("hwaddr");
if (index >= 0) {// 找到了
// 取出mac地址并去除2边空格
mac = line.substring(index + "hwaddr".length() + 1).trim();
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
bufferedReader = null;
process = null;
}
return mac;
}

/**
* 获取widnows网卡的mac地址.
*
* @return mac地址
*/
public static String getWindowsMACAddress() {
String mac = null;
BufferedReader bufferedReader = null;
Process process = null;
try {
// windows下的命令,显示信息中包含有mac地址信息
process = Runtime.getRuntime().exec("ipconfig /all");
bufferedReader = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String line = null;
int index = -1;
while ((line = bufferedReader.readLine()) != null) {
System.out.println(line);
// 寻找标示字符串[physical
index = line.toLowerCase().indexOf("physical address");

if (index >= 0) {// 找到了
index = line.indexOf(":");// 寻找":"的位置
if (index >= 0) {
System.out.println(mac);
// 取出mac地址并去除2边空格
mac = line.substring(index + 1).trim();
}
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bufferedReader != null) {
bufferedReader.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
bufferedReader = null;
process = null;
}

return mac;
}

/**
* windows 7 专用 获取MAC地址
*
* @return
* @throws Exception
*/
public static String getMACAddress() throws Exception {

// 获取本地IP对象
InetAddress ia = InetAddress.getLocalHost();
// 获得网络接口对象(即网卡),并得到mac地址,mac地址存在于一个byte数组中。
byte[] mac = NetworkInterface.getByInetAddress(ia).getHardwareAddress();

// 下面代码是把mac地址拼装成String
StringBuffer sb = new StringBuffer();

for (int i = 0; i < mac.length; i++) {
if (i != 0) {
sb.append("-");
}
// mac[i] & 0xFF 是为了把byte转化为正整数
String s = Integer.toHexString(mac[i] & 0xFF);
sb.append(s.length() == 1 ? 0 + s : s);
}

// 把字符串所有小写字母改为大写成为正规的mac地址并返回
return sb.toString().toUpperCase();
}
}

写一个全局拦截的servlet,只要有请求的时候就调用这个类里面的获取mac地址的方法

String os = getOSName();
System.out.println(os);
if (os.equals("windows 7")) {
String mac = getMACAddress();
System.out.println(mac);
} else if (os.startsWith("windows")) {
// 本地是windows
String mac = getWindowsMACAddress();
System.out.println(mac);
} else {
// 本地是非windows系统 一般就是unix
String mac = getUnixMACAddress();
System.out.println(mac);
}

记得判断一下是什么系统

❼ 怎么设置手机JAVA中软件的时间

QQ和UC的时间就是你手机上的时间啊~

❽ java中如何用时间限制程序的执行

用线程等待可以限制程序的运行吧,如果是网页,那么就有clearTimeout()方法!

❾ java编写的设置软件的使用期限,例如使用30天就不能用,再想用就得输入注册码,代码全点,最好带注释

UltraEdit的吗 我有用户名和注册码 只不过好像不能升级了
Name:jialei_wy
Code:DSQOQ-OSPNA-JIHHK-TNVIO-ONFGK-EERGI-QOMRC-LQJAK

Name:jialei wy
Code:IEPQA-PCOJD-KHLFV-QJVHX-LEJMC-LGTR2-POQC3-CNJIV

Name:woshilaji
Code:JBOLD-GRUJO-KGQG3-SHTI6-GFCG3-JNJNP-MNXMD-NHKPQ

Name:fuck you
Code:QMPFM-INRPV-LLOK8-KGRLM-NJKFA-ELWOV-JKDPQ-PQJMP
你试试吧 反正我就是这样注册的

❿ 怎么设置软件的使用期限

设置软件的使用期限方法如下:

程序开头,
可以 GetFileTime 函数获得 文件 建立的时间,或最后一次进入时间,或最后一次写的时间为准。同 当前时间 作对比,算出时间差。
决定退出程序 或 跑程序。
GetFileTime 函数原型:
BOOL WINAPI GetFileTime( _In_ HANDLE hFile, _Out_opt_ LPFILETIME lpCreationTime, //文件建立的时间
_Out_opt_ LPFILETIME lpLastAccessTime, //最后一次进入时间 _Out_opt_ LPFILETIME lpLastWriteTime // 最后一次写的时间
);
================
函数获得 文件 的时间, 还有简单办法: 调 DOS 命令,
DIR /TC 程序名 或
DIR /TA 程序名 或
DIR /TW 程序名
来获取 要的 3 个时间 之一。
用转向到文件 的方法 system( "DIR /TC yuci.exe > abc.tmp");
再打开 abc.tmp 读得 月日年时分 时间
11/06/2013 09:15 AM 34,521 yuci.exe
====
其它办法很多,例如写注册表,写文件。无非是记录时间。
====
如果规定好使用日期,直接取当前时间 now = time (NULL);
比较 规定的 截止日期就可以了。

阅读全文

与java设置软件使用期限相关的资料

热点内容
矛盾纠纷专项排查工作方案 浏览:103
法国发明家巴耶尔首创 浏览:561
油条机我爱发明 浏览:648
北京品源知识产权代理有限公司怎么样 浏览:240
著作权共同所有 浏览:778
二手途达转让 浏览:518
马鞍山市花湖 浏览:480
永乐票务投诉 浏览:951
龙游智慧教育公共服务平台 浏览:186
兴国工商局投诉电话 浏览:131
开封出租车投诉电话是多少 浏览:101
甘肃省基础资源公共服务平台 浏览:612
马鞍山父子身份 浏览:192
观通杭州知识产权 浏览:10
认缴资本期限 浏览:855
黑龙江企业培训师证书查询 浏览:16
投资被骗报案有期限吗 浏览:199
江苏哲力知识产权招聘 浏览:186
温州中小企业公共服务平台 浏览:54
英树创造101投票 浏览:596